53 ms·
I think the fundamental problem is that programmers have been taught that "abstract = good" in all things. How often do you hear someone say they "abstracted"
by overgard 10y ago
I think the fundamental problem is that programmers have been taught that "abstract = good" in all things.
How often do you hear someone say they "abstracted" a piece of code or "generalized" it, without anyone asking why? Or how often do people "refactor" things by taking a piece of code that did something specific, and giving it the unused potential to do more things while creating a lot of complexity? The problem with "abstracting" things is it means behaviors that were previously statically decidable can now only be determined by testing run-time behavior, or the key behaviors are now all driven from outside the system (configuration, data, etc.)
Also by making things more flexible, your verbs suddenly become a lot more general and so readability suffers.
Kind of an aside, but whenever I see code where a single class is split into one interface and one "impl" I've taken to calling it code acne (because Impl rhymes with pimple). If you're only using an interface for ONE class it's a huge waste of time to edit two files! The defense is always something like "well what if we need a mock version for tests". Fine, write the interface when you actually do that.