by darkerside · 7y ago · 0 comments
As the parent said:
>The question to ask is not, are these similar, but will they act and change in the same ways (to your best knowledge) both now and in the future?
If they represent different requirements, then the answer to the question is usually "No." So do not couple them together with an abstraction. If you do, you are not invoking DRY. You're just creating spaghetti.
I find SPOT (Single Point Of Truth) to be more to the point than DRY, because it is explicitly about semantics and not about mere syntactic repetition.
I mean honestly the SOLID advice is pretty terrible, but is so often repeated because it has such a great acronym.
I'm hoping I remember to steal this later!
https://www.sandimetz.com/blog/2016/1/20/the-wrong-abstracti...
On the other hand, I've definitely seen it become near impossible to unwind an abstraction once it starts getting used by other abstractions that are used in many other places in your code (multiply by as many levels or permutations as it takes to achieve desired level of complexity). Meanwhile, this poor function has been twisted to satisfy all these unreasonable demands from every corner of your codebase, and teasing it apart becomes an Herculean effort.