News for hackers. Stuff that matters.
Re:DRY is an over-rated programming principle? by tcfhgj on Thursday July 07, 2022 @05:55AM (#32011893)
> I think the article fails to show particularly problematic examples of DRY. E.g. merging two ~similar functions and adding a conditional for the non-shared codepaths. shudders

Not a problem of DRY, but bad code structure.

Just keep the two functions and pull the shared code-path out

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.