The Single Responsibility Principle
One of the most foundational principles of good design is:
- Gather together those things that change for the same reason, and separate those things that change for different reasons.
This principle is often known as the Single Responsibility Principle or SRP. In short it says that a subsystem, module, class, or even a function, should not have more than one reason to change. The classic example is an class that has methods that deal with business rules, reports, and database.
by Uncle Bob
This work is licensed under a Creative Commons Attribution 3
Back to 97 Things Every Programmer Should Know home page