4 ms·
> it points to the problem that what you sometimes really want is just a function Interestingly, this fact has been known to procedural as well as functional p
by adwn 12y ago
> it points to the problem that what you sometimes really want is just a function
Interestingly, this fact has been known to procedural as well as functional programming proponents for decades (one of the few aspects on which they agree).
- platz 12y agoThe problem with SRP is it's hard to define what that "one reason" is exactly. http://sklivvz.com/posts/i-dont-love-the-single-responsibility-principle http://sklivvz.com/posts/i-dont-love-the-single-responsibili... > sometimes really want is just a function summed up nicely here: http://blog.ploeh.dk/2014/03/10/solid-the-next-step-is-functional/ http://blog.ploeh.dk/2014/03/10/solid-the-next-step-is-funct...
- regularfry 12y agoI 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.
- SideburnsOfDoom 12y ago> The problem with SRP is it's hard to define what that "one reason" is exactly Sure it's hard to automate it. It's one of those subjective, experience-based factors that keep humans like me in a job. I never thought that it was a rule that can be mechanically applied.
- platz 12y agoSure, but there are other measures, and the coupling vs cohesion take at least provides a semblance of objectivity vs completely subjective.