Do Repeat Yourself

(arcentry.com)

43 points | by max_sendfeld 16 hours ago ago

14 comments

  • umvi 2 hours ago

    Or as the go proverb goes "a little copying is better than a little dependency" (https://go-proverbs.github.io/)

  • jedbrooke 3 hours 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.

    • caller9 2 hours ago

      I like HUMID "Hold off Until Many Instances of Duplication"

      • jagged-chisel 2 hours ago

        MOIST: "Mull Over Instances, Seek Third"

        Two is a coincidence, three is a pattern.

  • phptogowasfinet 2 hours ago

    I've seen this story many times, and most of them, these inefficiencies are kind of made up by the team not wanting to move. Generally, the UI team has good excuses related to Not-Built-Here, and the article provides precisely one such. Not saying Backend does not also have good excuses but

    > They just need a simple model-view-controller architecture like PHP provides. Having pointers to memory addresses and managing concurrency via goroutines rather than just writing linear PHP that Apache runs in parallel is really much more than they bargained for

    Is the kind that I've seen be the team's fault, with at least two instances of a guy going in and fixing the problem according to the new spec within three work days.

  • gavmor an hour ago

    > Except maybe for the investment banking team. They really need their Erlang architecture for decentralized networking - after all, they process fast-moving market data, order execution, and the like.

    I don't know... it seems to me that Go might actually be perfectly adequate for these workloads. The goroutine scheduler is a reliable way to handle concurrent market feeds AFAIK.

    Go can also do MVC just as well as PHP. Hell, the standard library has net/http and html/template, or you can reach for Using gsx (or templ) and your UI components are just compiled Go functions.

    I think the real problem in this scenario is that there's a bottleneck "platform" team. This takes the "dev" right out of devops.

    I'm just not sure that "you can't do everything in golang and react" holds water. You can do pretty much anything in anything, these days.

    DRY is supposed to be about reducing connascence, IMHO. You don't need a "platform" team to do that. You need transparency between teams so there's no duplicate effort. Something like a shared backlog.

  • parpfish 3 hours ago

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

    • gnabgib 3 hours 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

      • prmph 2 hours ago

        An abstraction is not only for avoiding repetition; it's for gaining deeper insight into what you are actually doing.

      • davnicwil 2 hours 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.

        • joshmoody24 43 minutes ago

          Personally, I've seen just as many bugs from two implementations drifting.

        • AspireOne 2 hours ago

          Ain't this the truth.

    • hungryhobbit 3 hours 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 2 hours 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.