Refactoring Approaches for Improving Software Flexibility
Abdullah Almogahed, Manal Othman, Hairulnizam Mahdin, Mustafa Moosa Qasim, Abdulwadood Mohamed Othman Alawadhi, Omar Al-Jamili, Mazni Binti Omar, Samera Obaid Barraood, Abdul Rehman Gilal · 2025
Software flexibility is a vital quality attribute that enables systems to adapt to evolving requirements, integrate emerging technologies, and support long-term maintenance. Refactoring, the practice of restructuring existing code without altering its external behavior, is a key strategy to enhance flexibility. However, the specific impact of individual refactoring approaches on software flexibility remains underexplored. This study investigates the effects of ten widely recognized refactoring approaches on software flexibility using the jEdit open-source dataset. A four-phase methodology was employed: selecting relevant refactoring approaches, choosing an appropriate dataset, identifying suitable software metrics, and applying the refactoring. Metrics such as MOA, DAM, DCC, and NOP were used to compute an aggregated flexibility score. The refactoring approaches were applied 352 times across 10 experiments across jEdit. Results revealed that Extract Class, Extract Subclass, Extract Superclass, and Encapsulate Field positively influence flexibility, while others, such as Inline Class and Push Down Method, may reduce it. These findings provide empirical evidence on how refactoring decisions can strategically improve software flexibility. The outcomes offer practical guidance for developers and software architects aiming to build more resilient and maintainable systems through informed and metrics-driven refactoring.