October 2018
Intermediate to advanced
590 pages
15h 5m
English
A class should have only one reason to change.
This principle is one of the simplest of the principles, yet the easiest to get confused about, mostly because of its name.
As mentioned in the book, Agile Software Development: Principles, Patterns, and Practices, a responsibility, in the context of the SRP, is a reason for a change. That is when you change a class, and if you can think of another reason to change it separately, such as at a different time, then that class violates the SRP.
Another interpretation is that responsibility is an axis of change. Inside a class, all of the changes should occur around a central point or a continuum. You can think of a class as a discussion room. In one room, ...
Read now
Unlock full access