Skip to main content
QUICK REVIEW

[论文解读] On the Impact of Refactoring on the Relationship between Quality Attributes and Design Metrics

Mohamed Wiem Mkaouer, Eman Abdullah AlOmar|arXiv (Cornell University)|May 1, 2019
Software Engineering Research参考文献 59被引用 76
一句话总结

本研究调查了软件开发人员在提交信息中自报的质量改进意图,与重构后结构设计度量指标变化之间的对齐情况。基于来自3,795个开源Java项目的1,245次重构提交的大型语料库,作者分析了重构前后的度量变化,发现当开发人员声称要提升内聚性、耦合度或复杂度时,LCOM、CBO和CC等度量指标显著改善;而NOC和设计规模度量等其他指标则与开发人员意图无显著关联。

ABSTRACT

Refactoring is a critical task in software maintenance and is generally performed to enforce the best design and implementation practices or to cope with design defects. Several studies attempted to detect refactoring activities through mining software repositories allowing to collect, analyze and get actionable data-driven insights about refactoring practices within software projects. Aim: We aim at identifying, among the various quality models presented in the literature, the ones that are more in-line with the developer’s vision of quality optimization, when they explicitly mention that they are refactoring to improve them. Method: We extract a large corpus of design-related refactoring activities that are applied and documented by developers during their daily changes from 3,795 curated open source Java projects. In particular, we extract a large-scale corpus of structural metrics and anti-pattern enhancement changes, from which we identify 1,245 quality improvement commits with their corresponding refactoring operations, as perceived by software engineers. Thereafter, we empirically analyze the impact of these refactoring operations on a set of common state-of-the-art design quality metrics. Results: The statistical analysis of the obtained results shows that (i) a few state-of-the-art metrics are more popular than others; and (ii) some metrics are being more emphasized than others. Conclusions: We verify that there are a variety of structural metrics that can represent the internal quality attributes with different degrees of improvement and degradation of software quality. Most of the metrics that are mapped to the main quality attributes do capture developer intentions of quality improvement reported in the commit messages, but for some quality attributes, they don’t.

研究动机与目标

  • 识别哪些结构设计度量最能反映开发人员在为质量改进而重构时的自报意图。
  • 实证评估最先进的设计度量是否能够捕捉开发人员对内聚性、耦合度、复杂度和继承性等质量属性的感知。
  • 揭示理论质量模型与实际开发人员重构实践之间的差异。
  • 为未来研究提供可复现的重构提交数据集及其相关的度量变化。

提出的方法

  • 从GitHub收集了3,795个经过筛选的开源Java项目,重点关注工程良好的系统。
  • 识别出1,245个提交,其提交信息中明确包含质量改进目标的开发人员陈述。
  • 应用最先进的重构挖掘工具(如Refactoring Miner)从这些提交中检测并提取重构操作。
  • 通过仅隔离重构的代码元素并按内部质量属性(如内聚性、复杂度)对提交进行聚类,进一步精炼数据集。
  • 为每个提交聚类计算27个结构设计度量的重构前和重构后值。
  • 进行统计分析(p值),评估度量变化的显著性,识别出哪些度量显著反映了开发人员意图。

实验结果

研究问题

  • RQ1当开发人员明确陈述质量改进目标时,哪些结构设计度量在重构后受到最显著影响?
  • RQ2常用的设计度量在多大程度上与开发人员在重构过程中的自报意图对齐?
  • RQ3是否存在某些质量属性(如内聚性、复杂度、继承性),其度量无法显著反映开发人员意图?
  • RQ4对于同一质量属性(如耦合度)的不同度量,其在捕捉开发人员对改进感知方面的表现如何比较?

主要发现

  • 当开发人员报告提升内聚性时,LCOM表现出统计显著改善(p = 0.0346),表明与开发人员意图高度一致。
  • 当开发人员旨在改善耦合度时,CBO和FANOUT均显著改善(p = 0.0400和p = 0.0456),证实了其代表性。
  • 当开发人员针对复杂度时,CC、WMC、RFC、Evg、NPATH和MaxNest均表现出显著改善(p ≤ 0.0062),证实了其相关性。
  • DIT是唯一在继承性方面显著改善的度量(p = 0.0439),而NOC反而增加(p = 0.0208),表明与开发人员感知存在不匹配。
  • 在封装性、抽象性或设计规模属性(如LOC、CLOC、CDL)方面未观察到显著的度量变化,表明目前无可靠度量能捕捉开发人员在这些属性上的意图。
  • WMC和RFC在多态性方面无显著变化(p > 0.5),表明与开发人员报告的目标对齐性差。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。