Hacker News new | ask | show | jobs
by johsole 13 days ago
There is an idea I have been enjoying called WET, Write Everything Twice. Basic idea is you should only make things more general and parameterized if you need to write it a third time.

The upshot of this is you actually have a much better understanding of the different way your script needs to work if you're adapting it for a third use instance.

1 comments

I would suggest that if you have two similar copies of sufficiently complex logic, it's fair to combine them after they have been stable for a long time. My gut feeling is that the threshold should be a function of complexity times stability in hours worked (on that part of the code), because the expected maintenance cost of duplicated code scales with its complexity.