Do Repeat Yourself

(arcentry.com)

25 points | by max_sendfeld 14 hours ago ago

6 comments

  • jedbrooke 43 minutes ago

    reminds me of WET: Write Everything Twice. Instead of immediately jumping to DRY, actually write out the two similar tools, then see what actually makes sense to combine into a shared dependency.

  • parpfish an hour ago

    So, instead of DRY code we should have DRY code?

    • gnabgib 39 minutes ago

      It's a fairly old acronym replacement after everyone realized "don't repeat yourself" was like "premature optimization" - and misleading people. Nothing wrong with a little repetition and a perfect abstraction is likely a wasted investment. There was also "do repeat yourself twice" and "don't repeat yourself thrice" (on the third copy.. think about optimizing)

      2009 Unit Testing - Do Repeat Yourself (8 points) https://news.ycombinator.com/item?id=819982

      2016 DRY: Do Repeat Yourself (6 points, 6 comments) https://news.ycombinator.com/item?id=11805945

      • davnicwil 31 minutes ago

        As I often like to say when DRY comes up, the fact is I've wasted way more time over the years fixing unforeseen bugs in abstraction layers than I would have making changes in two places sometimes. After a while you realise simple is usually better.

    • hungryhobbit 41 minutes ago

      Even the DRY principle isn't a hard and fast rule, and in fact most experienced engineers will say that two copies of duplicate code shouldn't be "DRY-ed up". Most set the max at three copies, because "DRY-ing up" code before that point ends up being counter-productive.

      Similarly here, except the author isn't talking about code, but systems made out of code. And they're not saying "don't get rid of repetition" ... they're just saying sometimes repetition serves a good purpose, so don't try to "DRY" everything up.

      • AnimalMuppet 22 minutes ago

        Well... remembering to ask "did you fix it everywhere?" is strictly harder than having only one place, if you don't introduce too much contortions to bring that about.

        If.