Back to Catalog
Code Smells
Change Preventers
Divergent Change
One class that needs to be changed for different reasons.
Intent & Description
'
🎯 Intent
Identify when a single class requires changes for multiple unrelated reasons.
📋 Context
You find yourself modifying the same class for different types of changes (database changes, UI changes, business logic changes).
💡 Solution
Split the class into separate classes, each responsible for a single type of change. Apply SRP.'
Real-world Use Case
Use when a class is modified for multiple unrelated reasons.
Source
📌 TL;DR
If a class changes for multiple reasons, split it. Single Responsibility Principle prevents divergent change.