June 2019
Beginner to intermediate
770 pages
19h 24m
English
The Single Responsibility Principle (SRP) can be the most difficult principle to understand. The general statement that "a class should have one, and only one, reason to change" shifts the definition of responsibility to the understanding of change in an object-oriented design. There are several reasons for change; the most salient reason for changing a class is to add a new feature. As noted earlier in the Open/Closed principle section, a feature should be added as an extension rather than a modification.
In many cases, the Interface Segregation Principle (ISP) seems to provide more concrete guidance for class design than the SRP. The SRP seems to be a summary of how a class looks when we've followed the ...
Read now
Unlock full access