4 ms·
I meant more as for non-trivial classes when people are deciding when to break up a class the "single responsibility" part is too loosely defined to the point w
by resonantjacket5 6y ago
I meant more as for non-trivial classes when people are deciding when to break up a class the "single responsibility" part is too loosely defined to the point where I've never seen people actually use it as a metric. I agree classes can grow too large the hard part is what rubric actually used for delineating it and just saying "single responsibility" really hasn't by itself been useful.
- drooby 6y agoThere has been plenty said about the topic. Have you read Clean Code? The Wikipedia page? The Pragmatic Programmer? The depth on the subject has been expanded far more than just “single responsibility”. Here is Bob responding to OPs link: http://blog.cleancoder.com/uncle-bob/2020/10/18/Solid-Relevance.html http://blog.cleancoder.com/uncle-bob/2020/10/18/Solid-Releva... Stating: “SRP) The Single Responsibility Principle. Gather together the things that change for the same reasons. Separate things that change for different reasons.” That’s a pretty clear delineation IMO.
- resonantjacket5 6y ago@drooby yes we've all had to learn about it in class. "Single responsibility" has a definition but I've never seen a person have a good time defining the "single responsibility" part that well IRL when it comes to making/changing a class. Ironically, I think bob's later clarifications that the single responsibility refers to where a person/department would want change is much more usable https://blog.cleancoder.com/uncle-bob/2014/05/08/SingleRepon https://blog.cleancoder.com/uncle-bob/2014/05/08/SingleRepon.... The want for change part is hard thing to define. Personally, I much prefer "separation of concerns" when deciding what to place where. I guess you could argue in some sense its around the same thing shrug.
- deleted 6y ago[deleted]