David Heinemeier Hansson

December 16, 2024

The premise trap

The hardest part for me about collaborating with junior programmers, whether it's in open source or at work, is avoiding the premise trap. That's where the fundamental assumptions baked into the first draft of the code aren't questioned until you've already spent far too long improving the implementation. It's the same with AI.

Because AI at the moment is like a superb junior programmer. One with an encyclopedic knowledge about syntax and APIs, but also one saddled with the same propensities to produce overly-complicated, subtly-defective solutions.

You could read this as a bullish signal for the future of AI programming. That the current trajectory is tracking with the human programmer's progression tree, and that eventually, like the best juniors, it'll graduate to senior levels of competence in the fine details of code aesthetics, novel problem reasoning, and architectural coherence. I hope that's the case.

But that doesn't change the fact that, as of right now, I've yet to see any of the AI models I've been using for the past year produce great code within domains that I'm very familiar with. Occasionally there'll be a glimmer, just like with promising junior programmers, but taken as a whole, the solutions almost always need material amounts of rework.

Which is when that premise trap claps!

I've seen this repeatedly with both the Ruby and JavaScript code that comes out of the AI, so I doubt it's that particular to one language over another. But the propensity to pull in needless dependencies, the overly-verbose presentation, and the architectural dead ends are there all the time.

This is what I hear from people who are trying to use AI to write entire systems for them without actually being capable programmers themselves. That it's an incredible rush to see a prototype come to life in mere minutes, but that actually moving this forward to something that works reliably often turns into a one-step-forwards-two-steps-backwards dance. (Not unlike the many stories someone might have getting catfished by a barely qualified junior programmer on Upwork!).

While that's frustrating, it makes perfect sense when you consider the training data that has been teaching these models. The endless stream of basic online tutorials, Stack Overflow simplified answers, and the unfortunate reality that a fair chunk of internet programming content is made by the blind leading the blind.

Senior human programmers all got started on the same information diet, but eventually graduated to higher levels of understanding and mastery by working on proprietary code bases. Where all the trade-offs that are absent in tutorial-style code reveal themselves and demand to be weighed with finesse.

I think the next big leap for these models under the current paradigm probably isn't likely to happen until they're exposed to a vast corpus on proprietary, corporate code. And how that's going to happen isn't entirely clear at the moment.

So in the mean time, as a senior programmer, you'd do well to treat AI as you would a junior programmer. It's rarely going to save you time asking it to produce an entire system, or even subsystem, if you care about the final quality of the architecture or implementation. Because to verify the assumptions that have been baked into its path will require spending as much time to understand the choices as it would doing the work yourself.

I remain bullish on AI writing code for us all, but also remain realistic about its current abilities. As well as alert to the danger of luring more senior programmers, including myself, into signing off on slop, while it saps our stamina for continued learning, as we lean too much on AI writing for us rather than teaching how.

May this piece age badly within a few short years!

About David Heinemeier Hansson

Made Basecamp and HEY for the underdogs as co-owner and CTO of 37signals. Created Ruby on Rails. Wrote REWORK, It Doesn't Have to Be Crazy at Work, and REMOTE. Won at Le Mans as a racing driver. Fought the big tech monopolies as an antitrust advocate. Invested in Danish startups.