The Single Responsibility Principle
Everyone in software development probably knows the Single Responsibility Principle (SRP) or at least assumes to know it. A common interpretation of this principle is this:
A component should do only one thing and do it right.
That’s good advice, but not the actual intent of the SRP.
Doing only one thing is actually the most obvious interpretation of “single responsibility,” so it’s no wonder that the SRP is frequently interpreted like this. Let’s just observe that the name of the SRP is misleading.
Here’s the actual definition of the SRP:
A component should have only one reason to change.
As we see, “responsibility” should actually be translated to “reason to change” instead of “do only one thing.” Perhaps we should rename the SRP to the “Single Reason to Change Principle.”
If a component has only one reason to change, it might...