3 ms·
I think it comes down to this: - If your code has a bug, you will be better off without duplication, so that the bug must only be fixed once. - If you will ha
by emtel 3y ago
I think it comes down to this:
- If your code has a bug, you will be better off without duplication, so that the bug must only be fixed once.
- If you will have to change the behavior of your code for product reasons, duplication is often better, because user needs are idiosyncratic. If the code is fully factored, you may have to pass in flags to indicate which behavior should be used in which case.
Learning to anticipate which of these two cases you might find yourself in in the future comes with experience.