Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@reggaeguitar Perhaps example work better than my word soup. async/await allows you to worry about what the code does without worrying about concurrency. Linq allows to separate where you get your data, from when to stop, from what you do with it. Without it you will have nested loops, that interleave those concerns. RAII allows you to separate deallocation. And you could work around a language that does not support such things, but that would require to introduce other code to make it work. Often some patterns, which require new classes. Plus the discipline to use them.
@reggaeguitar We often think of separation of concerns at a smaller scale. It happens inside a method, for example. It is in the way you write them. It does not have to mean extracting routines or classes. However, it can be useful to extract methods and classes for separation of concerns. In particular generators are a very useful tool for that. Also you may introduce new classes to make invariants concrete, or to reuse. Is that discovering or creating responsibilities? I'm not sure how to tell. We can certainly invent responsibilities. At the end of the day, these are guidelines.
@reggaeguitar For a piece of code, everything you need to consider is a concern. A single routine will have multiple concerns. And a concern can affect multiple routines. Separating them means that you should write the code in a way that you can consider one without worrying about the others. However, by single responsibility principle, a module should take care of a single responsibility. I'm taking responsibility to mean reason for change, and external to the system. And yes, that would mean that responsibilities are concerns too.
@Flater I don't want to wait for tests to run to discover I should not have removed this code block. And put me on the bad developers, because I began doing this for myself. I guess I should be writing more comments then.