[Paper Review] An Empirical Evaluation of Impact of Refactoring On Internal and External Measures of Code Quality
This empirical study evaluates the impact of ten refactoring techniques on both internal and external code quality measures in software systems. While external metrics like resource utilization and time behavior showed no improvement post-refactoring, internal metrics revealed a significant increase in maintainability index, suggesting refactoring enhances certain aspects of code quality, particularly maintainability.
Refactoring is the process of improving the design of existing code by changing its internal structure without affecting its external behaviour, with the main aims of improving the quality of software product. Therefore, there is a belief that refactoring improves quality factors such as understandability, flexibility, and reusability. However, there is limited empirical evidence to support such assumptions. The objective of this study is to validate/invalidate the claims that refactoring improves software quality. The impact of selected refactoring techniques was assessed using both external and internal measures. Ten refactoring techniques were evaluated through experiments to assess external measures: Resource Utilization, Time Behaviour, Changeability and Analysability which are ISO external quality factors and five internal measures: Maintainability Index, Cyclomatic Complexity, Depth of Inheritance, Class Coupling and Lines of Code. The result of external measures did not show any improvements in code quality after the refactoring treatment. However, from internal measures, maintainability index indicated an improvement in code quality of refactored code than non-refactored code and other internal measures did not indicate any positive effect on refactored code
Motivation & Objective
- To empirically validate or invalidate the widely held belief that refactoring improves software quality.
- To assess the impact of specific refactoring techniques on both internal and external code quality measures.
- To evaluate whether refactoring leads to measurable improvements in maintainability, flexibility, and reusability.
- To analyze the effects of refactoring on standard software quality factors such as cyclomatic complexity, coupling, and lines of code.
- To determine whether refactoring results in measurable improvements in external quality factors like changeability and analysability.
Proposed method
- The study applied ten specific refactoring techniques to a set of software systems to evaluate their impact on code quality.
- External quality measures—Resource Utilization, Time Behavior, Changeability, and Analysability—were collected and analyzed.
- Internal quality measures—Maintainability Index, Cyclomatic Complexity, Depth of Inheritance, Class Coupling, and Lines of Code—were computed before and after refactoring.
- The experiments were conducted on real-world codebases to ensure practical relevance and empirical validity.
- Statistical analysis was used to compare pre- and post-refactoring values across both internal and external metrics.
- The study used ISO-defined external quality factors and standard internal code metrics to ensure consistency and comparability.
Experimental results
Research questions
- RQ1Does refactoring lead to measurable improvements in external software quality factors such as resource utilization and time behavior?
- RQ2To what extent does refactoring affect internal code quality metrics like cyclomatic complexity and class coupling?
- RQ3Is there a statistically significant improvement in the maintainability index after refactoring?
- RQ4Do external quality factors such as changeability and analysability improve following refactoring?
- RQ5Which internal metrics show consistent positive changes after refactoring, and which do not?
Key findings
- External measures such as resource utilization, time behavior, changeability, and analysability showed no significant improvement after refactoring.
- The maintainability index increased significantly in refactored code compared to non-refactored code, indicating improved maintainability.
- Cyclomatic complexity, depth of inheritance, class coupling, and lines of code did not show consistent positive changes post-refactoring.
- The results suggest that while refactoring improves maintainability, it does not necessarily enhance performance or structural flexibility as commonly assumed.
- The study provides empirical evidence that refactoring's benefits are not uniformly distributed across all quality dimensions.
- Only one internal metric—maintainability index—demonstrated a clear positive effect, indicating limited overall impact on code quality.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.