3 ms·
> very few would agree I, for one, would agree. IMHO, DRY is only useful when the underlying problem structure has a fundamental overlap with an existing prob
by hnfong 4y ago
> very few would agree
I, for one, would agree.
IMHO, DRY is only useful when the underlying problem structure has a fundamental overlap with an existing problem. Incidental overlaps should be kept separate.
That's where the premature abstraction problem comes from. Often in times of changing requirements, you can't predict where things will lead to.
I suspect it's something to do with how OOP is taught. Universities start with abstract concepts and apriori principles (eg. encapsulation, polymorphism, etc.). So juniors fresh out of school tend to feel compelled to make up abstractions to be a "good citizen" so to speak.
OTOH I actually started by encountering issues with duplicate code and repeated patterns (which was a problem mainly because I had to copy and paste and retype too much code), and only afterwards I learned about how OOP techniques could help solve these problems. For me personally they were just practical tools to solve practical problems, instead of a moral imperative. I happily write very specific code to do specific things instead of pretending there's some apriori abstraction waiting to be discovered.
IMHO there's a humility in admitting that there's more than one way to look at (i.e. perceive in abstract manner) things.