We're all bad at writing software

After several discussions with fellow software developers about whether we could truly “let go” and trust LLM-generated code, and a high-profile quality facepalm case, I've been reflecting on my thoughts on the matter.

More often than not, I end up advocating for giving LLMs a chance, but I wouldn't count myself as a hyped-up AI booster. At least I wouldn't want to count myself as an unrealistic Kool-Aid drinker. I don't think LLMs are so good at generating code that we can just trust them and let go. No, they're capable of producing convoluted garbage and then politely apologizing for it.

No, my optimism comes from quite a different direction: I don't trust LLMs, but I don't trust humans either.

People (myself included) are exceptionally bad at writing software. We're so bad we've constructed an elaborate Tower of Babel to help us with the task—and still we fail.

From little things, like syntax highlighting to make the code easier to read, through linters, type checkers, correctness provers, all manner of different tests, to straitjackets of Rust and Haskell that try to keep us from blundering into a scary race condition, use after free, off-by-one and other spooky monsters hiding under our compilers.

Read 2000 lines (50 pages or so) from a book in an afternoon? Sounds like a wonderful and relaxing day. Read 2000 lines of (much sparser) code and you're wasted. It's hard, and you're almost guaranteed to miss something.

And that's in the best case, if you ignore company politics, endless sprinting through a growing backlog, bloated software full of crap features benefiting the company instead of the users, ... The list can go on and on; just look at The Daily WTF or Dilbert.

Crapware, bloatware and “stinkin' pile of shit” are terms that long predate LLMs. As a Hacker News commenter put it nicely:

software I used that was majority built by 'real human engineers' coding by hand is utter garbage. [...] The average software engineer cannot build good and secure software.

I'd go a step further and say: to the extent that you build correct, performant and secure software, you do it by diligently following best software engineering practices (like, but not limited to, exhaustive testing and debugging), not via your supreme intellect.

As Brian Kernighan put it:

Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?

Likewise, from Knuth:

Beware of the bugs in the above code; I have only proved it correct, not tried it.

Back to LLMs. Yes, they can produce garbage, just like humans. They can also produce good code, if they're properly guided and constrained, just like humans. And they keep getting better at it.

So yeah, I'm an optimist.

I love writing code and I'll keep writing code (by hand) for the fun of it. I have SICP, Programming Pearls and a few volumes of TAOCP on my bookshelf and have just ordered a paperback of Crafting Interpreters. Programming is fun!

I'm happy to leave grinding through Jira tickets, CRUD and enterprise integration glue code to my AI minions.


Entirely human-written; proofread by Claude.