Re:DRY is an over-rated programming principle?
by yoz-y on Thursday July 07, 2022 @06:03AM
(#32011961)
Not all the time. When the similar code mixes types and the common codepaths are sprinkled multiple times over it you can either have the code there twice, or have an overcomplicated templated common function.
In these cases factorizing may or may not be a good idea.
Re:DRY is an over-rated programming principle?
by _0ffh on Thursday July 07, 2022 @06:36AM
(#32012261)
I think it's just that for every complex topic, any general rule will break down at some point. That doesn't tell you that the rule is bad, but to learn how to tell when you're dealing with such an exception.
Not a problem of DRY, but bad code structure.
Just keep the two functions and pull the shared code-path out