5 ms·
I think the mistake that people make with DRY is that they apply it at the textual level. They think that if they see the same particular sequence of characters
by SuddsMcDuff 8y ago
I think the mistake that people make with DRY is that they apply it at the textual level. They think that if they see the same particular sequence of characters in multiple places that they've violated the principle and need to refactor.
I rather see it at the behavioural level. Important domain logic ought to have a single implementation to avoid discrepencies that can put the system in an inconsistent state. For example your e-commerce platform really ought to just have one way of calculating the total cost of an order.
But, if you've copy pasted the boilerplate code that sets up your logging subsystem in a dozen different places, who cares?
- C4stor 8y agoThe ops team care. When they'll want you to switch to another logging output config, you'll answer one hour later saying "done". Two days later, you'll fix another two or three of those config. One week later, you'll fix the final one. It's annoying to everyone. If it's not config, it's library versions, it's a change in a "boilerplate" argument, ... Code duplication makes it hard to update all the code that should be "the same". Everyone involved in actually having code updated every now and then cares about it.
- SuddsMcDuff 8y agoRate of change of a particular piece of code is a factor too, given. In my experience logging boilerplate has a very low rate of change, so I figured it was a good example, but I guess everyones experience is different.