Single Responsibility (SRP):
Symptom: Large classes handling multiple tasks.
Detection: Check for classes with too many responsibilities or methods. Use tools like SonarQube for complexity warnings.Open/Closed (OCP):
Symptom: Modifying existing classes for new features.
Detection: Review change logs and check for frequent edits to core classes.Liskov Substitution (LSP):
Symptom: Subclasses that break functionality when used in place of base classes.
Detection: Write unit tests that fail when incorrect subclass behavior is introduced.Interface Segregation (ISP):
Symptom: Classes implementing methods they don't use.
Detection: Look for bloated interfaces. Check if classes use all implemented methods.Dependency Inversion (DIP):
Symptom: High coupling between classes.
Detection: Identify direct dependencies on concrete classes. Use tools like NDepend to detect tight coupling.
💡General Tips: Use code reviews, static analysis tools (SonarQube, NDepend), and automated tests to catch violations.
Top comments (0)