Understanding what drives code instability is essential for effective software maintenance, as unstable classes require larger or more frequent edits and increase the risk of unintended side effects. Although code smells are widely believed to harm maintainability, most prior stability studies examine only the smells within the class being modified. In practice, however, classes can change because their efferent neighbors (i.e., the classes they depend on) are modified due to ripple effects that propagate along static dependencies, even if the class itself is clean. Such ripple effects may be more severe when the efferent neighbor exhibits code smells. In addition, code smells rarely occur alone. They often appear together within a class or across classes connected by static dependencies, a phenomenon known as code smell interrelation. Such interrelation can lead to code smell interaction, where smells are directly connected through static dependencies and may further compound maintainability issues. However, the effect of code smell interrelation and interaction on code quality remains largely underexplored. Therefore, this study investigates whether the presence of code smells in a class's efferent neighbors affects its stability, considering the factor of code smell interrelation and interaction. To achieve this, we mine one year of commit history from 100 top-starred GitHub projects, detect code smells and static dependencies, determine code smell interrelation and interaction, and model these factors as predictors of class stability.
翻译:理解驱动代码不稳定的因素对于有效的软件维护至关重要,因为不稳定的类需要更大或更频繁的编辑,并增加了意外副作用的风险。尽管人们普遍认为代码异味会损害可维护性,但先前大多数稳定性研究仅考察被修改类内部的异味。然而在实践中,类可能因其传出邻居(即它们所依赖的类)被修改而发生变化,这是由于沿着静态依赖关系传播的涟漪效应所致,即使类本身是“干净”的。当传出邻居表现出代码异味时,这种涟漪效应可能更为严重。此外,代码异味很少单独出现。它们经常在类内部或通过静态依赖关系连接的类之间共同出现,这种现象被称为代码异味相互关联。这种相互关联可能导致代码异味交互,即异味通过静态依赖关系直接连接,并可能进一步加剧可维护性问题。然而,代码异味相互关联和交互对代码质量的影响在很大程度上仍未得到充分探索。因此,本研究在考虑代码异味相互关联和交互因素的情况下,调查一个类的传出邻居中存在的代码异味是否会影响其稳定性。为实现这一目标,我们从100个高星标GitHub项目中挖掘了一年的提交历史,检测代码异味和静态依赖关系,确定代码异味的相互关联和交互,并将这些因素建模为类稳定性的预测因子。