159 points · by max_sendfeld · 2w ago · 51 comments
DRY doesn't mean don't repeat a similar looking block of code, it means try to structure your code so that each element of the design has a single representation.
There's no shortcut to good design where no thinking is required, much as a lot of people seem to wish there were.
But, like the rest of software, even that's just a guideline. Suppose you've been painted into a corner where code needs to be synced between languages. There are solutions, but especially if it happens rarely then those solutions might be a lot more expensive than just a comment at both locations.
We have thousands of years of combined experience in our various technologies and we are to throw that away in the name of "unity" for a stack literally no one in the company was using but "it should be good for AI"
A bigger part of the positives of repeating yourself is that yourself is plural in this case and other people kind of suck and solving your own problems should be easy.
As an example, I put in a request with the platform team to set the UI toolkit to internal instead of private so it can be more easily accessed cross organization. I have been waiting like six months. No one knew who was in charge of it. ALL our repos have been mandated internal for years so our disparate orgs can read each others code. AFAIK we're the only team that actually lives up to it.
I am annoyed by the lot of it.
Adding their chosen be-all-end-all solutions is the easy bit. Removing existing parts from the tech stack, is the hard part.
(and of course "new" may not improve on "old" even if stuff is migrated successfully)
The upside: all this changing / migrating / implementing / testing gives you a job.
If you find yourself writing it a third time, on the other hand, you should seriously start consolidating.
https://en.wikipedia.org/wiki/Rule_of_three_(computer_progra...
Although in reality I wrote some things thrice before deciding to condense them and I considered it decently DRY.
You end up with drifting implementations that may or may not come from the same root at different points, where the same fix has to be applied multiple times as each team learns the lessons for what not to do, etc. Effectively what DRY is about.
Code duplication is fine as long the duplicates don't drift apart. Keeping them in sync is a bit tedious for people. And people tend to cut corners. So there's a potential to end up having to fix the same kinds of issues several times. But with AIs doing all the tedious work, staying on top of that is pretty doable. It's more a question of whether that's a good use of time and tokens. You could just make it fix things properly.
In the code base I mentioned, we had a few different component libraries that at some point were selected, used, and then later abandoned. We also had taken into use tailwind at some point but we never completed the upgrade to tailwind 4. And we had a bunch of manually styled html as well. It's an application with a lot of different functionality, lots of different screens, etc. So there was a bit of pressure to not break things. I fixed all of that in a few prompts. The application still looks and feels the same but is much more consistent in terms of look and feel (we had several varieties of buttons and input fields with subtly different behavior). We found and fixed a few minor issues since then.
[0] https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction
Because when you have 20+ repetitions you start needing buy-in for fixes because the testing needed might be beyond something simple.
Which is to say, standard does not imply good. A lot of times companies just standardize around how they did things most recently, which means they haven't learned all the problems yet.
> 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.
> All three teams adhered to the corporate branding guidelines, so their products look and feel reasonably similar. They also work fairly well and were shipped on time. This is the opposite of how things play out in most of the world's large companies, from any major bank to supposedly tech-savvy giants like Google. Every time you cross an app boundary or even a team boundary within a single product, all bets are off. At best, the UI differs in small, annoying ways (button styling, UI element rounding radii), or at worst, you need to go through separate login and payment flows.
> whenever the user switches from the account view to the investing tab, a whole new JS framework is loaded. But, given all other factors, this is an acceptable trade-off. I guess it's acceptable if you are going from one major product to another, but accepting this when switching between parts of an application that are supposed to be coherent (same banking app, same money involved) tells the customer that you don't care about their experience that much. Accepting this also massively increases the chances that the UX will be different, since frameworks tend to come with their own patterns that shape developer thinking.
Of course, it's OK to repeat yourself as many times as needed to keep shipping products that affect the bottom line of the business and help customers achieve more. At the same time, as a company transitions to multiple products or breaks up the monolith of its main product, it should also start building the DNA for maintaining a coherent UX. This is less about using the same technologies under the hood and more about crystallizing the foundational API shapes and packaging them in a way that allows teams to offer customers a consistent set of UX expectations across internal company boundaries.
In practice, this means that some choices have to be made in a BDFL-style fashion: one general-purpose OLTP database with a preferred way of interacting with it (ORM or not), one JS framework with components supporting shared data structures (with escape hatches for specialized use cases), and one opinionated design system covering the vast majority of use cases across the company's major products.
It's okay to say that you have an Ops team in 2026. If it's not DevOps then let's not call it that.
Then I clicked and read and nodded a bunch.
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
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.
If.
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.
not many other disciplines have this issue, all trades workers like carpenters or welders just repeat and repeat