What is the difference between Single Responsibility Principle and Separation of Concerns?
views:
339answers:
5Single Responsibility states that an Object be responsible for a single unit of work.
Seperation of Concerns states that applications should be split in to modules whose functionalities overlap as little as possible.
Similar end results...slightly different applications.
In my opinion Single Responsibility Principle is one of the tools/idioms to achieve Separation of Concerns.
Separation of Concerns is a process; the Single Responsibility Principle is a design / architecture philosophy. They're not completely disjoint, but they serve different purposes.
Single Responsibility Principle (SRP)- give each class just one reason to change; and “Reason to change” == “responsibility”. In example: Invoice class does not have a responsibility to print itself.
Separation of Concerns (since 1974). Concern == feature of system. Taking care of each of the concerns: for each one concern, other concerns are irrelevant. Hiding implementation of behavior.
From here.