3 ms·
Sometimes if each repeated bit of code is slightly different the common method ends up being really complicated. I would rather make 6 simple changes than do on
by sjducb 5y ago
Sometimes if each repeated bit of code is slightly different the common method ends up being really complicated. I would rather make 6 simple changes than do one really complicated change.
The other problem with a DRY method is that you often increase cyclomatic complexity. Where each single method has one execution path (6 paths in total) the DRY method has 6 slightly different intentional execution paths, but 2^6 possible paths, this can make reasoning about the method impossible.