3 ms·
"A common justification for this sort of complexity is that it makes the code more reusable, and in some cases it is justified." And as you note, sometimes it'
by a3n 13y ago
"A common justification for this sort of complexity is that it makes the code more reusable, and in some cases it is justified."
And as you note, sometimes it's not justified.
And sometimes, the attempt itself either fails or reusability is reduced. An example would be a method or function whose primary concern is a calculation or decision, to which you add the use of that calculation (printing, logging, painting a screen, blowing a horn). Now you can never calculate that decision without also printing, loggging, painting or blowing. You'd made it less reusable.
A technique does not ensure its advertised benefit.