3 ms·
There's a more abstract/meta-level strategy or philosophy at the heart of this issue that I feel I've progressively gotten more wisdom on. IMHO: DRY has trade-
by user3939382 5y ago
There's a more abstract/meta-level strategy or philosophy at the heart of this issue that I feel I've progressively gotten more wisdom on. IMHO:
DRY has trade-offs like everything else. Code that is very new, maybe built to satisfy business requirements that are still fuzzy, and shifting around a lot, can result in perfectly DRY code returning a net negative cost/benefit.
As your requirements solidify and the code matures, the net benefit of DRY code increases, often at a super-linear rate.
Going back to your example, I'd say go ahead and copy and paste if and when that strategy fits the scenario, and with the consciousness that you're taking on planned tech debt.
- anamax 5y agoI've found more success with DRY2x, that is, it's okay to repeat myself once, but when I run into something three times (second repeat), it's worth of some attention.