Search code examples
design-patternsseparation-of-concernssingle-responsibility-principle

Difference between Concern and Responsibility ( ie difference between SRP and SoC )?


SRP - each class should have just one responsibility ( ie reason to change)
Separation of Concerns is the process of breaking a computer program into distinct features that overlap in functionality as little as possible. A concern is any piece of interest or focus in a program. (Concern == feature of system. )

a) To my understanding the only difference between the two is that SRP tries to separate responsibilities into different classes and SoC tries to separate concerns into different modules?!

b) If assumption under a) is correct, what is the difference between a concern and a responsibility ( besides the fact that responsibility exists at a lower level of abstraction )?

Thank you


Solution

  • That is how I view them - the same principle, usually referenced at different levels of abstraction.