Co-Occurrence of Design Patterns and Bad Smells in Software Systems: An Exploratory Study
Resumo
A design pattern is a general reusable solution to a recurring problem in software design. Bad smells are symptoms that may indicate something wrong in the system design or code. Therefore, design patterns and bad smells represent antagonistic structures. They are subject of recurring research and typically appear in software systems. Although design patterns represent good design, their use is often inadequate because their implementation is not always trivial or they may be unnecessarily employed. The inadequate use of design patterns may lead to a bad smell. Therefore, this paper performs an exploratory study in order to identify instances of co-occurrences of design patterns and bad smells. This study is performed over five systems and discovers some co-occurrences between design patterns and bad smells. For instance, we observed the co-occurrences of Command with God Class and Template Method with Duplicated Code. The results of this study make it possible to understand in which situations design patterns are misused or overused and establish guidelines for their better use.
Referências
C. Bouhours, H. Leblanc, and C. Percebois. Sharing bad practices in design to improve the use of patterns. In proc. of the Conference on Pattern Languages of Programs, 2010.
C. Jebelean, C. Chirila, and V. Cretu. A Logic Based Approach to Locate Composite Refactoring Opportunities in Object-Oriented Code. In Int’l Conf. on Automation Quality and Testing Robotics, vol. 3, p. 1–6, 2010
E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Pearson Education, 1994.
F. Fontana and S. Spinelli. Impact of Refactoring on Quality Code Evaluation. In proc. of the 4th Workshop on Refactoring Tools, p. 37–40, 2011.
F. Khomh. Squad: Software Quality Understanding Through the Analysis of Design. In 16th Working Conference on Reverse Engineering, p. 303– 306, 2009.
G. Carneiro et al. Identifying Code Smells with Multiple Concern Views. In Brazilian Symposium on Software Engineering, p. 128-137, 2010.
J. Garcia, D. Popescu, G. Edwards, N. Medvidovic. Identifying Architectural Bad Smells. European Conf. on Software Maintenance and Reeng, 2009.
J. Kerievsky. Refactoring to Patterns. Pearson, 2005.
J. Padilha et al. On the Effectiveness of Concern Metrics to Detect Code Smells: An Empirical Study. In Int’l Conf. on Advanced Information Systems Engineering (CAiSE), 2014
J. Perez and Y. Crespo. Perspectives on Automated Correction of Bad Smells. In proc. of the Int’l Workshop on Principles of Software Evolution, p. 99–108, 2009.
K. Beck, et al. Industrial Experience with Design Patterns, In Proc. Conf. Software Eng. p. 103-114, 1996.
L. Prechelt, B. Unger, W. Tichy, P. Brössler, L. Votta. A Controlled Experiment in Maintenance Comparing Design Patterns to Simpler Solutions, In IEEE Transactions on Software Eng., vol. 27, no. 12, p. 1134-1144, 2001
M. Dodani. Patterns of Anti-Patterns. Journal of Object Technology, p. 29–33, 2006.
M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, 1999.
M. Lanza and R. Marinescu. Object-Oriented Metrics in Practice. Springer, 2006.
N. Tsantalis and A. Chatzigeorgiou, Identification of Move Method Refactoring Opportunities. IEEE Transactions on Software Engineering, pp 347–367, 2009.
N. Tsantsalis, A. Chatzigeorgiou, G. Stephanides, S. Halkidis, Design Pattern Detection Using Similarity Scoring. IEEE Trans. on Soft. Engineering, vol. 32, p. 896-909, 2006.
O. Seng, J. Stammel, and D. Burkhart. Search-based Determination of Refactorings for Improving the Class Structure of Object-Oriented Systems. In proc. of the Conf. on Genetic and Evolutionary Computation, 2006.
P. Wendorff. Assessment of Design Patterns during Software Reengineering: Lessons Learned from a Large Commercial Project. In European Conference on Software Maintenance and Reengineering, p. 77–84, 2001.
R. Agrawal, I. Tomasz, and A. Swami. Mining Association Rules Between Sets of Items in Large Databases. ACM SIGMOD Record. Vol. 22. No. 2. 1993.
S. Brin et al. Dynamic Itemset Counting and Implication Rules for Market Basket Data. ACM SIGMOD Record. vol. 26, 1997.
T. Copeland, PMD Applied: Centennial Books, 2005.
W. Brown, et al. Antipatterns: Refactoring Software, Architectures, and Projects in Crisis, 1998.
W. McNatt, and J. Bieman. Coupling of design patterns: Common practices and their benefits. In Annual International Computer Software and Applications Conference, p. 574–579, 200.
Y. Luo, A. Hoss, and D. Carver. An Ontological Identification of Relationships between Anti-patterns and Code Smells. In Aerospace Conference, p. 1–10, 2010.