The Influence of Code Smells in Efferent Neighbors on Class Stability
Zushuai Zhang, Elliott Wen, Ewan Tempero
TL;DR
This study tackles the problem that software stability is driven not only by intrinsic properties of a class but also by ripple effects from changes in its efferent neighbors, especially when those neighbors carry code smells. It analyzes one year of commits from 100 top-starred Java projects, detecting ten code smells and mapping static dependencies to study how smells in efferent neighbors, smell interrelation, and smell interaction relate to class stability, measured via $ChF$ and $ChS$ using $NB$-GLMs with project-level random intercepts. The work provides replication-ready methods and first empirical evidence on how efferent-neighbor smells and their interactions influence stability, yielding actionable insights for smell detection prioritization and refactoring decisions. The findings have practical implications for maintenance planning and tool support, clarifying when ripple effects propagate through dependencies and how to mitigate associated risks.
Abstract
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.
