Incidence of code smells in the application of design patterns: a method-level analysis

  • Ederson Assunção UFBA
  • Rodrigo Souza UFBA

Resumo


Design patterns are reusable solutions that can be applied to solve specific problems in software design. Such patterns can be misapplied, though, and give rise to code smells, i.e., fragments in the code that indicate possible design flaws. In this study, we aim to understand how often code smells co-occur with design patterns, as well as to determine the most common co-occurrences. To this end, we identified instances of code smells and design patterns in methods of 25 open source Java projects, by using automated detection tools. We also manually inspected fragments of the projects' source code to gather insight on the relationship between specific pairs of smells and patterns. Among other findings, we found that methods that are part of the Adapter pattern are more likely to contain code smells, especially the Feature Envy smell, although it can be argued that the detection of this smell in this context is a false positive.
Palavras-chave: Code Smells, Design Patterns, Software Design
Publicado
23/09/2019
ASSUNÇÃO, Ederson; SOUZA, Rodrigo. Incidence of code smells in the application of design patterns: a method-level analysis. In: SIMPÓSIO BRASILEIRO DE COMPONENTES, ARQUITETURAS E REUTILIZAÇÃO DE SOFTWARE (SBCARS), 13. , 2019, Salvador/BA. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2019 . p. 73–82.