Abstract Context Short development cycles and continuous delivery pressure often push developers toward expedients that lead to poor design and hard-to-maintain systems. A common remedy is code refactoring, which reduces complexity and improves maintainability, though often seen as costly and risky. Objective We investigate the long-term effects of refactoring to provide recommendations that support strategic development decisions. Method We assess refactoring impact through change- and defect-proneness analysis, as well as benefit/effort evaluation. Results Most refactorings have short-lived effects, persisting for fewer than 10 changes. Structural refactorings may last over 190 changes, with significant differences across families. Medium-lived refactorings (9–19 changes) prove the most stable and efficient, while longer-lasting ones become increasingly defect-prone and costly. Conclusions Refactorings differ in sustainability. Medium-duration refactorings strike the best balance between stability and maintenance cost, while structural ones, though impactful, pose higher long-term risks. These insights guide prioritization of refactoring types to maximize benefit and minimize technical debt.
Robredo et al. (Thu,) studied this question.