Code Refactoring for Software Reusability: An Experimental Study
Abdullah Almogahed, Hairulnizam Mahdin, Mazidah Mat Rejab, Abdulwadood Mohamed Othman Alawadhi, Samera Obaid Barraood, Manal Othman, Omar Al-Jamili, Abdulwahab Ali Almazroi, Shazlyn Milleana Shaharudin · 2024
Refactoring plays a critical role in enhancing the quality of software systems, enabling them to accommodate growing user bases, feature sets, and performance demands. Software reusability is an essential aspect of software quality. It is crucial in modern software development as it offers several benefits, including increased productivity, improved code quality, and cost-effectiveness. However, there is a lack of studies investigating how specific refactoring techniques affect reusability. Therefore, this study aims to explore the effects of code refactoring on software reusability. This study was conducted in four stages: selecting refactoring techniques, selecting a large dataset, selecting software metrics to measure the reusability, and applying the refactoring techniques. The five most common refactoring techniques (Extract Interface, Encapsulate Field, Extract Class, Inline Class, and Inline Method) used in practices were selected and applied in the jEdit dataset. The refactoring techniques were carried out 338 times through five experiments in the jEdit dataset. The finding reveals that Extract Interface, Encapsulate Field, and Extract Class significantly improve the code reusability while Inline Class and Inline Method impair it. Developers and software architects can use this knowledge to make well-informed judgments about refactoring techniques and develop more robust and reusable software systems.