首页 | 本学科首页   官方微博 | 高级检索  
     


The relationship between design patterns and code smells: An exploratory study
Affiliation:1. Faculty of Computing, Poznań University of Technology, Poznań, Poland;2. Poznań Supercomputing and Networking Center, Poznań, Poland;1. Computer Science Department, UFMG, Brazil;2. Department of Computing, CEFET-MG, Brazil;1. Coordenação de Informática, IFBA, Feira de Santana BA, Brazil;2. Centro de Informática, Universidade Federal de Pernambuco, Recife-PE, Brazil;3. Departamento de Informática e Matemática Aplicada, UFRN, Natal-RN, Brazil;1. Pontifical Catholic University of Rio de Janeiro (PUC-Rio), Rio de Janeiro, Brazil;2. State University of Goiás (UEG), Posse-GO, Brazil
Abstract:Context—Design patterns represent recommended generic solutions to various design problems, whereas code smells are symptoms of design issues that could hinder further maintenance of a software system. We can intuitively expect that both concepts are mutually exclusive, and the presence of patterns is correlated with the absence of code smells. However, the existing experimental evidence supporting this claim is still insufficient, and studies separately analyzing the impact of smells and patterns on code quality deliver diverse results.Objective—The aim of the paper is threefold: (1) to determine if and how the presence of the design patterns is linked to the presence of code smells, (2) to investigate if and how these relationships change throughout evolution of code, and (3) to identify the relationships between individual patterns and code smells.Method—We analyze nine design patterns and seven code smells in two medium-size, long-evolving, open source Java systems. In particular, we explore how the presence of design patterns impacts the presence of code smells, analyze if this link evolves over time, and extract association rules that describe their individual relationships.Results—Classes participating in design patterns appear to display code smells less frequently than other classes. The observed effect is stronger for some patterns (e.g., Singleton, State-Strategy) and weaker for others (e.g., Composite). The ratio between the relative number of smells in the classes participating in patterns and the relative number of smells in other classes, is approximately stable or slightly decreasing in time.Conclusion—This observation could be used to anticipate the smell-proneness of individual classes, and improve code smell detectors. Overall, our findings indicate that the presence of design patterns is linked with a lower number of code smell instances. This could support programmers in a context-sensitive analysis of smells in code.
Keywords:
本文献已被 ScienceDirect 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号