中文

代码异位邻居中的代码异味对类的稳定性影响

软件工程 2026-02-17 v2

摘要

理解驱动代码稳定性的因素对于有效的软件维护至关重要,因为不稳定的类需要更大或更频繁的编辑,并增加意外副作用的风险。虽然代码异味被广泛认为会损害可维护性,但大多数先前的稳定性研究仅检查被修改类的异味。实际上,类可能会因其efferent neighbors(即依赖它的类)由于沿着静态依赖关系传播的涟漪效应而发生更改,即使该类本身干净无异味。当efferent neighbor exhibits 代码异味时,这种涟漪效应可能更为严重。此外,代码异味很少单独出现。它们往往在单个类中或通过静态依赖关系连接的类之间共现,一种称为代码异味 interrelation 的现象。这种 interrelation 可能导致代码异味 interaction,即异味通过静态依赖关系直接相互连接,并可能进一步加剧可维护性问题。然而,代码异味 interrelation 和 interaction 对代码质量的影响仍在很大程度上未被探索。因此,本研究 investigates efferent neighbors 中的代码异味是否影响其稳定性,考虑到代码异味 interrelation 和 interaction 的因素。为实现这一目标,我们从100个top-starred GitHub 项目中挖掘一年的提交历史,检测代码异味和静态依赖关系,确定代码异味 interrelation 和 interaction,并将这些因素建模为类的稳定性预测器。

关键词

引用

@article{arxiv.2602.12950,
  title  = {The Influence of Code Smells in Efferent Neighbors on Class Stability},
  author = {Zushuai Zhang and Elliott Wen and Ewan Tempero},
  journal= {arXiv preprint arXiv:2602.12950},
  year   = {2026}
}

备注

Accepted as a Registered Report at the International Conference on Mining Software Repositories (MSR) 2026