3
itsfhm
7y

I feel that sometimes using the principles of DRY is just overkill and serves as an incubator for over engineering something that could be really simple. Something's are just going to be used once and never again...

This is not a anti structure rant just a thought.

Comments
  • 2
    dry isn't a "principle" it's common sense in programming, always aim for a reasonably general solution before making the same functionality twice, if a general solution is an overkill, extract the similarities in a shared common core, there a fuckton of ways to do this without repeating yourself or over engineering
  • 0
    @Qchmqs I hear you. I'm just referring to what I've seen in codebases I've inherited.
  • 0
    @itsfhm that's like saying eating with forks is bad, because my grandma makes a mess when she uses one
  • 0
    @Qchmqs I like the analogy. Though I think there are valid cases where DRY creates more complexity and risk.

    For example, say we were designing an aircraft - two engines or one? A single engine design needs more than twice the engineering effort and can fail in more ways than a smaller engine of half the power.

    I agree that duplication without refactoring is bad. But if like DNA you duplicate and refactor. You can achieve an efficient design more quickly than if you set about with a complex first version of a design.
  • 0
    @kunashe dry isn't for physical objects, in your example, do we make a new machine to build each engine ? do we design each engine from scratch ?
Add Comment