3 ms·
Philosophically, I agree. I view premature abstraction in the same light as premature optimization. It's usually easier to optimize later since optimisations a
by jiggy2011 15y ago
Philosophically, I agree. I view premature abstraction in the same light as premature optimization.
It's usually easier to optimize later since optimisations are often just taking sections of code independantly and making them quicker. There is the whole 90/10 rule (or whatever it's called) that says it's better to highly optimise a few sections of bottleneck code rather than the whole thing.
Trying to retrofit an abstraction to a piece of code is almost always a horrible experience frought with mess and compromise.
- sbov 15y agoPremature abstractions can have similar issues: unless you have more than 2 cases you don't necessarily know what your abstraction should look like. As the cases pile up you find yourself increasingly shoehorning implementations into abstractions that don't quite abstract correctly.
- Dove 15y agoTrying to retrofit an abstraction to a piece of code is almost always a horrible experience frought with mess and compromise. Yes, and unless the problem is trivial or your experience in the domain is such that your foresight borders on the clairvoyant, this is guaranteed to happen. No matter how much (or little) design you do up front. The key is to recognize the right time to stop and refactor, so as to keep the pain that comes with learning the problem space to a minimum.
- humbledrone 15y ago> Trying to retrofit an abstraction to a piece of code is almost always a horrible experience frought with mess and compromise. It is amazing to me that our experiences are so different: I have found the exact opposite of this statement to be true. The only way that I've ever come up with a good abstraction is by starting with something concrete (preferably two or more instances) and factoring out the commonality. Retrofitting a piece of code to an abstraction that was designed in a vacuum tends to be an exercise in frustration, due to the abstraction being shortsighted and insufficiently suited to the problem space.