The definition of SRP is to have each class (or module) to have a single reason to change. I don't see how that has anything to do with having each line be assigned a responsibility. If the line changes for the same reasons as it surrounding lines, then, they are part of the same component (to use the author's wording). My guess is that the principle is being taken literally from its name/acronym.
Answering that question requires domain interrogation. If after that I'm still unsure, then I err on the side of having two copies with maybe a comment on both pointing to the other.
I'd say people more often try to extract a generic component "Group 0" way too early, when no all the differences are obvious. And de-generalizing it (aka introducing copypasta) actually makes everything clearer, simpler, easier to change and reason about.
So as in every such blog post -- "it depends".
I.e. within the domain are the (O) basic structures, relations and operations.
Then (T) practical supporting algorithms, tuned for performance in specific cases, serialize, visualize, or whatever.
Then (A) the code that uses O & A to implement the details of specific solutions or manage specific processes.
Wherever there is a well defined broad class of problems with shared structure, this approach has merit.
• Minimize AT -> A, T, O or X.
• Minimize A -> T, O or X.
• Minimize T -> O or X.
• Minimize O -> X.
Where Blood Type X is... Well its just code that doesn't need to exist. Now all possible code has a blood type. And highest productivity is to increase code in X.
As they say, less (OTA), is more! (X)
In all my years, all the companies and codebases I have ever seen, I have literally never seen a system chopped up this way by the SRP. The number of monoliths, though, are uncountable. The number of modules where some function is trying to juggle 8 different tasks, all conflicting … this is the constant state of affairs of actual code in the industry.
The SRP is not about chopping code up into (literal!) single lines; as I (and many others — this isn't some unique thought of mine) the SRP is about semantic, not syntactic — responsibility. It is fine, within the SRP, to have syntactically identical functions, if they serve semantically different purposes. "Are these two functions/sections of code bound to be the same by the law of physics?" If "no" … it's fine if there's a little copy paste here and there. Copy B's requirements might change down the line, and coalescing them into a single copy would be pain later down the line.
Drink with moderation.
> The big advantage of a group 0 component is that you can consume it within components from any other group (like blood type 0 (sic) can be received by any other type).
sigh. The blood type is "type O". Though, I do like the A/T separation, and yeah, generic-ish things become away of specific logic is usually a smell. (Though I'd love, like, some thoughtful reasoning. It resonates with me … but maybe a "why?".)
You'll want to do exactly the opposite. This just leads to maximizing dependencies and grinding everything to halt as everything you could fix in 2 mins will take 6 months of waiting instead. Also literally anything can be "reused" with enough configuration and parameters, with them becoming the source of complexity and programming itself and at the end of the day it was a huge waste to effectively create a new programming language.
I've worked with probably 6 or 7 different "microservice" based systems at this point, essentially all of them are just distributed monoliths. I don't think I've met a single person at my company who actually know what the hell a "microservice" is.
I also don't really see the challenge here. Is it just that people can take things too far? No shit. Extreme adherence to any principle or rule of thumb is rarely a good thing.