Publication | Closed Access
Multi-Criteria Code Refactoring Using Search-Based Software Engineering
136
Citations
72
References
2016
Year
Software MaintenanceEngineeringSoftware SystemsSoftware EngineeringSoftware AnalysisSpaghetti CodeSearch-based Software EngineeringSoftware Re-engineeringDesignShotgun SurgeryMulti-criteria CodeComputer ScienceCode RefactoringSoftware DesignRefinement TechniqueProgram AnalysisSoftware TestingFormal MethodsRefactoring
Refactoring improves software quality by restructuring code without altering its external behavior, yet it must also minimize code changes, preserve design semantics, and remain consistent with prior refactorings. The authors propose a multi‑objective search‑based method that automatically recommends refactorings balancing quality improvement, minimal code changes, semantic preservation, and consistency. They evaluated the approach on six open‑source systems using 11 refactoring types and six defect categories, conducting expert studies and an industrial validation with ten engineers on a large project. The method preserves design coherence, achieves acceptable code‑change levels, and leverages prior refactoring knowledge to guide recommendations.
One of the most widely used techniques to improve the quality of existing software systems is refactoring—the process of improving the design of existing code by changing its internal structure without altering its external behavior. While it is important to suggest refactorings that improve the quality and structure of the system, many other criteria are also important to consider, such as reducing the number of code changes, preserving the semantics of the software design and not only its behavior, and maintaining consistency with the previously applied refactorings. In this article, we propose a multi-objective search-based approach for automating the recommendation of refactorings. The process aims at finding the optimal sequence of refactorings that (i) improves the quality by minimizing the number of design defects, (ii) minimizes code changes required to fix those defects, (iii) preserves design semantics, and (iv) maximizes the consistency with the previously code changes. We evaluated the efficiency of our approach using a benchmark of six open-source systems, 11 different types of refactorings (move method, move field, pull up method, pull up field, push down method, push down field, inline class, move class, extract class, extract method, and extract interface) and six commonly occurring design defect types (blob, spaghetti code, functional decomposition, data class, shotgun surgery, and feature envy) through an empirical study conducted with experts. In addition, we performed an industrial validation of our technique, with 10 software engineers, on a large project provided by our industrial partner. We found that the proposed refactorings succeed in preserving the design coherence of the code, with an acceptable level of code change score while reusing knowledge from recorded refactorings applied in the past to similar contexts.
| Year | Citations | |
|---|---|---|
Page 1
Page 1