5 ms·
I find Uncle Bob's definition of SRP makes far more sense if you change it from "responsibility for something" to "responsibility to someone." That is, there s
by regularfry 12y ago
I find Uncle Bob's definition of SRP makes far more sense if you change it from "responsibility for something" to "responsibility to someone." That is, there should be one and only one person, or business role, who would want a given class to change. The "one reason" then becomes "That guy over there gave me a business justification for it," and nothing else really matters. It's just as easily read then as "a class cannot serve two masters."
- tel 12y agoThat matches well with the original guiding principles for software modularity: modules should encapsulate deferred or changing decisions, nothing more or less.
- platz 12y agoI think the point is you cannot predict what decisions are going to change or be deferred. That's why I like the interpretations of this that try to make change in any direction more reasonable. Otherwise you get people building things like abstract factories "just in case".
- tel 12y agoI think that's a little silly, or rather worded imprecisely. Freedom in all directions prohibits all structure, all implementation.