Peter Mawhorter

Peter Mawhorter (pmawhort@wellesley.edu)

August 29th, 2025

Coding with a Large Language Model is the Opposite of DRY

This post is one of my advice & arguments pages about the harms and hazards of the AI Hype Movement.

An important principle in software engineering is DRY: Don’t Repeat Yourself. We recognize that having the same code copied in more than one place is bad for several reasons:

  1. It makes the entire codebase harder to read.
  2. It increases maintenance burden, since any problems in the duplicated code need to be solved in more than one place.
  3. Because it becomes possible for the copies to drift apart if changes to one aren’t transferred to the other (maybe the person making the change has forgotten there was a copy) it makes the code more error-prone and harder to debug.

All modern programming languages make it almost entirely unnecessary to repeat code: we can move the repeated code into a “function” or “module” and then reference it from all the different places it’s needed. At a larger scale, someone might write an open-source “library” of such functions or modules and instead of re-implementing that functionality ourselves, we can use their code, with an acknowledgement. Using another person’s library this way is complicated, because now you’re dependent on them: if they stop maintaining it or introduce bugs, you’ve inherited a problem, but still, you could always copy their project and maintain your own version, and it would be not much more work than if you had implemented stuff yourself from the start. It’s a little more complicated than this, but the basic principle holds, and it’s a foundational one for software development in general and the open-source movement in particular. The network of “citations” as open-source software builds on other open-source software and people contribute patches to each others’ projects is a lot of what makes the movement into a community, and it can lead to collaborations that drive further development. So the DRY principle is important at both small and large scales.

Unfortunately, the current crop of hyped-up LLM coding systems from the big players are antithetical to DRY at all scales:

I think this is an important critique in part because it cuts against the argument that “LLMs are the modern compliers, if you reject them you’re just like the people who wanted to keep hand-writing assembly code, and you’ll be just as obsolete.” Compilers actually represented a great win for abstraction, encapsulation, and DRY in general, and they supported and are integral to open source development, whereas LLMs are set to do the opposite.

[1] to see what this looks like in action in prose, see the example on page 30 of the NYTimes copyright complaint against OpenAI (https://nytco-assets.nytimes.com/2023/12/NYT_Complaint_Dec2023.pdf). Based on how these models function, the exact same thing will happen with code sometimes.