4 ms·
The author sounds like even though they have read extensively about various "best" practices, they did not really gain an understanding of the tradeoffs involve
by jsbg 2y ago
The author sounds like even though they have read extensively about various "best" practices, they did not really gain an understanding of the tradeoffs involved with each one.
> “Don’t Repeat Yourself” (DRY) is basically good advice, but sometimes just copy/pasting things is just the more pragmatic thing to do, and not really a big deal.
Duplicating code on purpose is not about being pragmatic, it's about recognizing when DRY would violate the single responsibility principle.
The ability to weigh tradeoffs in context is what makes some engineers better than others.
- layer8 2y agoThe problem with DRY is that it is expressed incorrectly and misleadingly. There is little inherent benefit in avoiding code duplication, and it can do harm when done for the wrong reasons. The actual context is change management. Will the copy of the code likely have to change in the same way as the original? Only then should duplication be avoided. The rule taken literally fails to convey this important precondition and the reasoning behind it. (And so does WET.)
- recursive 2y ago> The author sounds like even though they have read extensively about various "best" practices, they did not really gain an understanding of the tradeoffs involved with each one. It sounds to me like they did understand the tradeoffs. But that they were being brow-beaten to apply "best practices" that were inapplicable because of the tradeoffs.