| Prefer duplication over the wrong abstraction (2016)(sandimetz.com) | |
| 497 points by rafaepta 19 hours ago | 318 comments | |
tl;dr: Sandi Metz argues that premature or incorrect abstractions are more costly than duplicated code, because subsequent developers tend to preserve the abstraction by piling on parameters and conditionals, eventually producing incomprehensible code. Her recommended fix is to fight the sunk cost fallacy: inline the abstraction back into each caller, strip out the unused branches, and let the resulting duplication reveal a better abstraction. The fastest way forward, when an abstraction is wrong, is backward. | |
HN Discussion:
| |