3 ms·
I agree that about not doing premature abstraction, and thinking about future evolution rather than just current similarity when deciding whether to abstract or
by ummonk 8y ago
I agree that about not doing premature abstraction, and thinking about future evolution rather than just current similarity when deciding whether to abstract or not. However, I don’t think it is difficult to unwind an abstraction. You just go to all the usages of the abstracted entity and replace them with specific code. Doing the opposite on the other hand is much harder if you have multiple sites that do something similar but not in somewhat different ways because they were written separately - it is much harder to merge the usages into a single abstraction, for the same reason it is hard to switch between libraries that do the same thing because the different libraries have different APIs.
- darkerside 8y agoWhy is it hard to merge them? If they're doing the exact same thing, replacing with an abstracted function should be straightforward. If they're doing different things, merging them may be unwise, since they may truly be different conceptually. On the other hand, I've definitely seen it become near impossible to unwind an abstraction once it starts getting used by other abstractions that are used in many other places in your code (multiply by as many levels or permutations as it takes to achieve desired level of complexity). Meanwhile, this poor function has been twisted to satisfy all these unreasonable demands from every corner of your codebase, and teasing it apart becomes an Herculean effort.