Single Responsibility Principle (SRP):
Single responsibility principle [1] means that any one class should not have more than one reason to change. For this to be true, a class will only have one single responsibility.
Avoid creating a god class [2]. Objects that are controlling way too many other objects in a system and often becoming “The Class That Does Everything” is known as a “God class”.
Straight forward easy to read comments on our classes and methods can help one recognize if the single responsibility principle is being adhered to.
References
- Single Responsibility Principle, https://en.wikipedia.org/wiki/Single_responsibility_principle
- God Class, Wiki.c2.com, http://wiki.c2.com/?GodClass
[…] [S] The Strategy Pattern permits each subclass to focus on a single responsibility. […]
[…] The Factory Pattern permits each subclass to focus on the single responsibility of building a specific object […]