Difference between revisions of "Single Responsibility Principle"

From JholJhapata
Line 1: Line 1:
Single Responsibility Principle states that one class should only serve one purpose, it does not mean that each class should have only one method or property but they should all relate directly to the responsibility of the class.
+
'''Single Responsibility Principle''' states that one class should only serve one purpose, it does not mean that each class should have only one method or property but they should all relate directly to the responsibility of the class.
  
 
When a class serves multiple responsibility/purposes then we should separate it into different classes.
 
When a class serves multiple responsibility/purposes then we should separate it into different classes.

Revision as of 17:01, 14 August 2019

Single Responsibility Principle states that one class should only serve one purpose, it does not mean that each class should have only one method or property but they should all relate directly to the responsibility of the class.

When a class serves multiple responsibility/purposes then we should separate it into different classes.