Hacker News new | ask | show | jobs
by kitsunesoba 1197 days ago
With time I've progressively become less concerned with staying DRY, which perhaps counterintuitively has made it easier to avoid spaghetti problems. It's easier to keep things clean with a handful of near-duplicates that are tailored to the needs of their call sites than it is with a single trying to do everything.

It's a bit more work to keep behavior consistent across duplicates but I'll take it if it means less untangling work for myself in the future.

1 comments

I’ve found the same, and have leaned more into patterns and proximity as guides. Find good patterns that can be repeated easily and predictably. Also, keep related code close together so it’s easy to find and copy somewhere else. Often times there are higher level abstractions that emerge which can then be “dry”ed out, but trying to do that too early creates more problems than it solves.