Enhancing Recommendations of Composite Refactorings based on the Practice. Bibiano, A. C., Coutinho, D., Uchôa, A., Assunção, W. K. G., Garcia, A., de Mello, R., Colanzi, T., Tenório, D., Vasconcelos, A., dos Santos Neto, B. F., & Ribeiro, M. In Proceedings of the 24th IEEE International Conference on Source Code Analysis and Manipulation (SCAM), 2024, Flagstaff, AZ, United States, 7-8 October 2024, pages 1–11, 2024.
Enhancing Recommendations of Composite Refactorings based on the Practice [pdf]Paper  abstract   bibtex   2 downloads  
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 introduce or replace smells, requiring further removal later in the project. Moreover, existing recommendations are not well-detailed and do not alert developers about possible side effects of current recommendations. 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, Extract 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.

Downloads: 2