2 ms·
The response for an “in case” is premature abstraction. Unused abstraction makes reasoning about the codebase harder.
by nobodyandproud 2y ago
The response for an “in case” is premature abstraction.
Unused abstraction makes reasoning about the codebase harder.
- cogman10 2y agoI have found that early/premature abstraction generally has the opposite of the intended effect. Rather than making the system open to extension and flexible, it pours code concrete around the concrete classes and the interfaces. Invariably, the interface ends up with every public method of the only implementing class. And methods taking "SuperInterface" which only use a subinterface of that interface can't be untangled without a ton of effort. Meanwhile, if you can figure out small reasonable interfaces with potentially multiple implementers, then all the sudden things get a lot easier to deal with.
- a_wild_dandan 2y agoAnd they're expensive. You pay thrice: 1. Engineering the generalized solution, then 2. Carrying the cognitive burden of this new indirection layer, and finally 3. Ripping out this premature -- and so likely wrong -- abstraction Premature abstractions are like alcohol: fun borrowed from the future, and paid back later with interest. If unavoidable, choose the abstraction most narrowly scoped to your actual code base, not a future one. Humans suck at prediction. Ask me how I know.
- taneq 2y agoI like the comparison with alcohol, and on a tangent from that... I wonder if the 'Ballmer Peak' is partly explicable by being just drunk enough to avoid this kind of abstraction procrastination.