Single Responsibility Principle (SRP)
The Single Responsibility Principle is the first of the five SOLID principles. It states that “a class or module should have only one reason to change,” meaning it should have only one job or responsibility.
Key aspects:
- Each component should do one thing and do it well
- If a class or function handles multiple concerns, split it into separate components
- Makes code more modular, testable, and maintainable