The relationship between design patterns and code smells: An exploratory study

被引:26
|
作者
Walter, Bartosz [1 ]
Alkhaeir, Tarek [2 ]
机构
[1] Poznan Univ Tech, Fac Comp, Poznan, Poland
[2] Poznan Supercomp & Networking Ctr, Poznan, Poland
关键词
Design patterns; Code smells; Software evolution; Empirical study; MAINTENANCE;
D O I
10.1016/j.infsof.2016.02.003
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
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. (C) 2016 Elsevier B.V. All rights reserved.
引用
收藏
页码:127 / 142
页数:16
相关论文
共 50 条
  • [1] Building empirical knowledge on the relationship between code smells and design patterns: An exploratory study
    Santos, Jose Amancio M.
    Antunes Petronilo, Gadiel Xavier
    [J]. JOURNAL OF SOFTWARE-EVOLUTION AND PROCESS, 2022, 34 (09)
  • [2] Empirical study of the relationship between design patterns and code smells
    Alfadel, Mahmoud
    Aljasser, Khalid
    Alshayeb, Mohammad
    [J]. PLOS ONE, 2020, 15 (04):
  • [3] The Effect of Code Smells on the Relationship Between Design Patterns and Defects
    Alkhaeir, Tarek
    Walter, Bartosz
    [J]. IEEE ACCESS, 2021, 9 (09): : 3360 - 3373
  • [4] The Relationship Between Code Smells and Traceable Patterns - Are They Measuring the Same Thing?
    Codabux, Zadia
    Sultana, Kazi Zakia
    Williams, Byron J.
    [J]. INTERNATIONAL JOURNAL OF SOFTWARE ENGINEERING AND KNOWLEDGE ENGINEERING, 2017, 27 (9-10) : 1529 - 1547
  • [5] An Exploratory Study on the Relationship of Smells and Design Issues with Software Vulnerabilities
    Oishwee, Sahrima Jannat
    Codabux, Zadia
    Stakhanova, Natalia
    [J]. PROCEEDINGS OF THE 1ST INTERNATIONAL WORKSHOP ON MINING SOFTWARE REPOSITORIES APPLICATIONS FOR PRIVACY AND SECURITY, MSR4P&S 2022, 2022, : 16 - 20
  • [6] Code smells in pull requests: An exploratory study
    Azeem, Muhammad Ilyas
    Shafiq, Saad
    Mashkoor, Atif
    Egyed, Alexander
    [J]. SOFTWARE-PRACTICE & EXPERIENCE, 2024, 54 (03): : 419 - 436
  • [7] A study on correlations between architectural smells and design patterns
    Pigazzini, Ilaria
    Fontana, Francesca Arcelli
    Walter, Bartosz
    [J]. JOURNAL OF SYSTEMS AND SOFTWARE, 2021, 178
  • [8] Revisiting the Relationship Between Code Smells and Refactoring
    Yoshida, Norihiro
    Saika, Tsubasa
    Choi, Eunjong
    Ouni, Ali
    Inoue, Katsuro
    [J]. 2016 IEEE 24TH INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION (ICPC), 2016,
  • [9] A Systematic Literature Mapping on the Relationship Between Design Patterns and Bad Smells
    Sousa, Bruno L.
    Bigonha, Mariza A. S.
    Ferreira, Kecia A. M.
    [J]. 33RD ANNUAL ACM SYMPOSIUM ON APPLIED COMPUTING, 2018, : 1528 - 1535
  • [10] An exploratory study on cooccurrence of design patterns and bad smells using software metrics
    Sousa, Bruno L.
    Bigonha, Mariza A. S.
    Ferreira, Kecia A. M.
    [J]. SOFTWARE-PRACTICE & EXPERIENCE, 2019, 49 (07): : 1079 - 1113