3 ms·
I tend to see this when people try to pre-emptively abstract. Not "we seem to be duplicating 3+ blocks of code here" but "we might want to do this again at some
by crdoconnor 10y ago
I tend to see this when people try to pre-emptively abstract. Not "we seem to be duplicating 3+ blocks of code here" but "we might want to do this again at some point so we need an abstraction to make it easier next time".
The former almost always works while the latter almost always fails.
The former gives a little dopamine hit and a boost to the ego because that's being "an architect" while the latter feels more like being a janitor. Ironic really.
- cygned 10y agoInterestingly, the second approach is often recommended in functional languages, although in a slightly different way; compose complex/complicated logic of small pieces. You end up with a lot more functions but it allows for code reuse. I am note quite sure, though, if we can already talk about an abstraction then.
- AstralStorm 10y agoThere is no code reuse of small non-generic functions in practice, just duplication and thus ravioli code. And to make these small functions generic costs time. What may make sense is to make something similar to lemma in proofs. This is strictly for ease of debugging or readability.
- danielhooper 10y agoI also believe it to be an attempt to avoid refactoring by trying to get things "right" the first time.
- ArkyBeagle 10y agoI think "kill your ego" and be happy with the janitorial aspect of it. De-duplication is "equivalent" to ( LZW style ) compression, and LZW compression is a solved problem. But local conditions may insist more on de-duplication.
- btbuildem 10y agoA janitor is more familiar with his building than the architect.