Software Engineering
Stability risks hide in dependencies: Study finds code quality issues in used classes matter more than expected
A new analysis of 152 Java projects shows that code smells in classes your code depends on can destabilize your own code, even if yours is clean.
Most software teams focus on keeping their own code clean to maintain stability, but a new study from arXiv suggests they're overlooking a critical source of instability: the quality of the code their classes depend on.
The Hidden Impact of Dependencies#
Researchers examined one year of commit history from 152 popular Java projects on GitHub to understand what makes classes unstable—that is, prone to frequent or substantial changes. Traditional wisdom holds that code smells (patterns indicating design problems) within a class are the main culprit behind maintenance headaches and unintended side effects. However, the study reveals that this view is incomplete.
When classes you depend on—known as efferent neighbors in software architecture—contain code smells, changes to those dependencies can trigger a cascade of modifications throughout your own code. These ripple effects propagate along static code dependencies even if your class itself has no quality issues whatsoever.
A More Complete Picture of Stability Risk#
The research demonstrates that examining code smells only within the class being modified provides an incomplete assessment of stability risk. By analyzing code smells in both a class and its dependencies, the team discovered stability vulnerabilities that would remain hidden using conventional analysis methods.
The findings go further: when researchers modeled the relationships between smells in a class and its dependencies together, additional stability risks emerged that neither analysis in isolation could reveal.
Implications for Maintenance Practices#
These results suggest that code quality initiatives should expand beyond internal refactoring. Teams maintaining classes should also assess the stability and design health of classes on which they depend, treating code smell analysis as a dependency-aware discipline rather than a purely internal exercise. This broader perspective could help developers anticipate instability before problems cascade through their systems.