midOOP
What is the Single Responsibility Principle?
Updated May 17, 2026
Short answer
A class should have only one reason to change.
Deep explanation
Each class should handle one responsibility to improve maintainability and reduce complexity.
Real-world example
Separating logging from business logic.
Common mistakes
- Creating god classes with multiple responsibilities.
Follow-up questions
- What happens if SRP is violated?
- How to identify responsibilities?