[论文解读] An Empirical Evaluation of Impact of Refactoring On Internal and External Measures of Code Quality
本实证研究评估了十种重构技术对软件系统内部和外部代码质量度量的影响。尽管重构后资源利用率和时间行为等外部度量未见改善,但内部度量显示可维护性指数显著提高,表明重构提升了代码质量的某些方面,尤其是可维护性。
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
研究动机与目标
- 为了实证验证或证伪广泛持有的观点,即重构能提升软件质量。
- 评估特定重构技术对内部和外部代码质量度量的影响。
- 评估重构是否带来可维护性、灵活性和可重用性方面的可测量改进。
- 分析重构对标准软件质量因素(如圈复杂度、耦合度和代码行数)的影响。
- 确定重构是否带来可测量的外部质量因素(如可修改性和可分析性)的改进。
提出的方法
- 本研究将十种特定的重构技术应用于一组软件系统,以评估其对代码质量的影响。
- 收集并分析了外部质量度量——资源利用率、时间行为、可修改性和可分析性。
- 在重构前后计算了内部质量度量——可维护性指数、圈复杂度、继承深度、类耦合度和代码行数。
- 实验在真实世界代码库上进行,以确保实际相关性和实证有效性。
- 使用统计分析比较了重构前后在内部和外部度量上的数值差异。
- 本研究采用ISO定义的外部质量因素和标准内部代码度量,以确保一致性和可比性。
实验结果
研究问题
- RQ1重构是否带来资源利用率和时间行为等外部软件质量因素的可测量改进?
- RQ2重构在多大程度上影响了圈复杂度和类耦合度等内部代码质量度量?
- RQ3重构后可维护性指数是否出现统计上显著的提升?
- RQ4重构后可修改性和可分析性等外部质量因素是否有所改善?
- RQ5哪些内部度量在重构后表现出一致的正向变化,哪些没有?
主要发现
- 重构后,资源利用率、时间行为、可修改性和可分析性等外部度量未见显著改善。
- 与非重构代码相比,重构后的代码可维护性指数显著提高,表明可维护性得到改善。
- 圈复杂度、继承深度、类耦合度和代码行数在重构后未表现出一致的正向变化。
- 结果表明,尽管重构提升了可维护性,但并不一定如普遍假设的那样增强性能或结构灵活性。
- 本研究提供了实证证据,表明重构的益处并非在所有质量维度上均匀分布。
- 仅有唯一一个内部度量——可维护性指数——表现出明确的正面影响,表明重构对整体代码质量的影响有限。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。