Divergent Change: What It Costs and How to Fix It
A single class that must be modified for many different, unrelated reasons.
What It Is
Divergent Change is the opposite of Shotgun Surgery. Instead of one change requiring edits in many classes, Divergent Change means a single class is modified for many unrelated reasons. If you change the class when a database schema changes, when a UI requirement changes, and when a business rule changes, you have Divergent Change. The class has accumulated responsibilities from multiple domains, making it a bottleneck that every change must flow through.
Why It Costs Money
The class becomes a merge conflict hotspot. When unrelated changes (database, UI, business logic) all modify the same file, developers working on independent features collide. The more unrelated reasons the class has to change, and the more people changing it, the more often those changes meet in the same file.
Testing is expensive because each change reason has different test requirements. Database changes need integration tests, UI changes need rendering tests, business logic needs unit tests, and they all live in the same class.
Code review quality drops. Reviewers cannot specialise: a database expert reviewing a PR that also contains UI changes in the same file must review code outside their expertise or approve blindly.
Specific Cost Mechanisms
- ●Merge conflicts: whenever two changes in flight touch the same coupled pair
- ●Cross-domain testing: each change requires running all test categories for the class
- ●Review quality: mixed-concern PRs are harder to review, because each change has to be checked against several unrelated concerns
Estimated Annual Cost
Cost of one instance a year by team size, from our model at $180K fully-loaded cost per engineer. Low and high use the bottom and top of the High inputs; mid is halfway. See full methodology.
| Team Size | Low | Mid | High |
|---|---|---|---|
| 3 devs | $3K | $7K | $11K |
| 5 devs | $4K | $10K | $16K |
| 8 devs | $6K | $15K | $24K |
| 10 devs | $7K | $19K | $30K |
| 20 devs | $14K | $35K | $57K |
These are model outputs, not measurements. Every input is on the cost model page, and the same model produces the figures on the 22 smells page. Put in your own team and cost in the smell profile calculator.
How to Detect It
Specific rules and thresholds for automated detection. See full tool comparison.
High class coupling and many responsibilities
Large files that change frequently across commits
Files with highest commit frequency across different feature branches
Identifies files changed by many different authors for different reasons
Refactoring Patterns
Proven techniques to eliminate this smell. See all refactoring patterns.
Extract Class
Groups of methods that serve distinct change reasons
Extract Module/Package
The extracted classes form a coherent domain boundary
Apply Single Responsibility Principle
The class has 3+ identifiable change reasons