Hacker News new | ask | show | jobs
by zendist 749 days ago
The rule of three[1] also comes to mind and is a hard learned lesson.

My brain has a tendency to desire refactoring when I see two similar functions, I want to refactor--it's almost always a bad idea. More often than not, I later find out that the premature refactoring would've forced me to split the functions again.

1: https://en.m.wikipedia.org/wiki/Rule_of_three_(computer_prog...

2 comments

better understand DRY first, before you add lots of technical debt to your code: https://news.ycombinator.com/item?id=40525064#40525690
Nice, I advocate for this but never new it was a more formal thing.