3 ms·
> It's better if there's only one place to fix it, because when you've fixed it, you've fixed all of it. You've got one aspect, and the other aspect is that co
by naasking 9y ago
> It's better if there's only one place to fix it, because when you've fixed it, you've fixed all of it.
You've got one aspect, and the other aspect is that code factored into a reused function F is now reviewed more too, ie. whenever you're reviewing the callers, you work through the functions they call as well to trace the behaviour. So you're also much more likely to find any bugs in F.
It's a double-whammy for bug squashing, which is why DRY is such an important principle. Certainly there are some misapplications, but its benefits hold up pretty well in a wide variety of scenarios.