3 ms·
I read a blog post somewhere (don't remember where) that describes the process of unfactoring (multiplying?) code as an exercise. Copy/paste the code until ther
by MathMonkeyMan 3y ago
I read a blog post somewhere (don't remember where) that describes the process of unfactoring (multiplying?) code as an exercise. Copy/paste the code until there's one straight code path per use case. Then examine the similarities and factor the code again. What you end up with will often be different from what you started with, and probably simpler, especially if the code had begun to drift from its original author's design.
So, "unfactor" the code and then factor it again. Let's call it... "refactoring."
My $0.02, then, is that "the wrong abstraction" assumes that you are unwilling to change it. What if we were comfortable tearing down our classes all willy nilly and replacing them with some other thing? Is it too risky? Does it hurt too many feelings?
Maybe the problem lies there, instead of in duplicate vs. abstract.