Enhancing Recommendations of Composite Refactorings based on the Practice
Refactoring is a non-trivial maintenance activity. Developers spend time and effort refactoring code to remove structural problems, i.e., code smells. Recent studies indicated that developers often apply composite refactoring (composite, for short), i.e., two or more interrelated refactorings. However, prior studies revealed that only 10% of composite refactorings are considered complete, i.e., those fully removing code smells. Many incomplete refactorings can even replace or introduce smells, requiring additional effort for their removal later in the project. Moreover, existing refactoring recommendations are not well-detailed and do not alert developers about these possible side effects. To address these gaps, we conducted a large-scale study involving more than 250k refactorings from 42 software projects, including both open-source and closed-source projects. Our goal is to investigate how the most common complete composites are combined and their side effects in the practice. Our results reveal that the current recommendation to apply Extract Method(s) with fine-grained refactoring types needs refinements. We found that certain fine-grained refactorings like Change Variable Types and Change Return Types can introduce up to 45% of Brain Methods when combined with Extract Method(s). Moreover, Ex-tract Method(s) and Move Method(s), a common recommendation to remove Feature Envy, may inadvertently introduce about 30% of Lazy Classes and approximately 70% of Data Classes. Despite these potential side effects, existing refactoring catalogs and tools' recommenders do not alert developers about these side effects. Finally, we consolidate our findings into a catalog to provide clear guidance for developers and researchers on effectively applying composite refactorings to fully remove code smells.
Authors
- Ana Carla Bibiano (ORCID: https://orcid.org/0000-0003-3730-9290)
- Daniel Tenório
- Alessandro Garcia
- Rafael de Mello (ORCID: https://orcid.org/0000-0002-9877-3946)
- Wesley K. G. Assunção (ORCID: https://orcid.org/0000-0002-7557-9091)
- A. S. do E. Vasconcelos
- Márcio Ribeiro (ORCID: https://orcid.org/0000-0002-4293-4261)
- Thelma Elita Colanzi (ORCID: https://orcid.org/0000-0001-9761-1999)
- Daniel Coutinho (ORCID: https://orcid.org/0000-0003-4226-2458)
- Anderson Uchôa (ORCID: https://orcid.org/0000-0002-6847-5569)
- Baldoíno Fonseca (ORCID: https://orcid.org/0000-0002-0730-0319)
Institutions
- Universidade Federal do Rio de Janeiro (BR)
- Universidade Estadual de Maringá (BR)
- Universidade Federal do Acre (BR)
- North Carolina State University (US)
- Pontifícia Universidade Católica do Rio de Janeiro (BR)
- Universidade Federal de Alagoas (BR)
Publication Details
- Published
- 2024-10-07
- DOI
- https://doi.org/10.1109/scam63643.2024.00018
- Citations
- 3
- Primary Topic
- Manufacturing Process and Optimization
- Type
- article
- Field-Weighted Citation Impact
- 1.05
Funders
- Coordenação de Aperfeiçoamento de Pessoal de Nível Superior
- Fundação de Amparo à Pesquisa do Estado de Alagoas
- Conselho Nacional de Desenvolvimento Científico e Tecnológico
- Fundação Carlos Chagas Filho de Amparo à Pesquisa do Estado do Rio de Janeiro
- Fundação Cearense de Apoio ao Desenvolvimento Científico e Tecnológico