SOLID OOP, Single Responsibility Principle

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

  1. Single Responsibility Principle, https://en.wikipedia.org/wiki/Single_responsibility_principle
  2. God Class, Wiki.c2.com,  http://wiki.c2.com/?GodClass

 

2 thoughts on “SOLID OOP, Single Responsibility Principle

Leave a Reply

Your email address will not be published. Required fields are marked *