Chapter 11: The Best Code is Boring
“Civilization advances by extending the number of important operations which we can perform without thinking about them.”
— Alfred North Whitehead
The best code I’ve ever worked with was Stripe’s API.
I don’t mean the most clever, or the most elegant, or the most impressive. I mean the code that got out of my way and let me build what I needed to build. Every endpoint did exactly what its name suggested. Every parameter was where I expected it to be. Every error message told me what went wrong and how to fix it. I could guess the method names before I looked them up, and I was usually right.
That’s boring code. Code that refuses to surprise you. Code that does one thing well and doesn’t try to do other things while it’s at it. Code with an API so predictable you can use autocomplete and trust what comes back. Code that breaks in expected ways, and otherwise just works.
Boring is a compliment. It might be the highest compliment code can receive.
What Boring Means
Boring code is recognizable the moment you encounter it. Not because it announces itself, but because it doesn’t.
Boring code has a guessable API. The verbs and nouns are exactly what you’d expect. If you’re looking for a method to create a user, it’s called createUser. If you’re looking for the service that handles payments, it’s called PaymentService. The arguments come in a consistent order. The return types are predictable. You don’t have to read the documentation to use it correctly, because the code communicates its intent through naming alone.
Boring code does one thing. A function that calculates an invoice total calculates the invoice total. It doesn’t send emails. It doesn’t update reports. It doesn’t notify the CEO. It takes inputs, produces outputs, and leaves everything else alone. When you need to understand what the code does, you can read it in isolation. When you need to change it, you can change it without fear.
Boring code follows conventions. It uses the patterns your team already knows. It puts files where the framework expects them. It names things the way the ecosystem names things. A new engineer can open the codebase and predict what they’ll find before they find it. The structure is familiar because it’s the same structure they’ve seen in every other well-maintained project.
Boring code breaks in expected ways. When something goes wrong, the error points to the problem. The stack trace makes sense. The failure mode is one you’ve seen before, which means you already know how to fix it. There are no mysteries, no paranormal behavior, no hours spent wondering why the system is doing something it shouldn’t be able to do.
Beauty and Boring
Chapter 8 talked about beautiful code, the kind that explains itself, that feels inevitable, that makes the reader feel smart rather than small. Boring code lives in the same neighborhood, but it’s not quite the same house.
Beautiful code is about clarity. How easily the intent flows from the screen to your brain. You read it and you understand it, and the understanding feels effortless.
Boring code is about predictability. How much the code matches the mental model you already have. You don’t have to learn anything new to work with it. You already know what it does because it does what everything like it does.
Beauty can still surprise you with its elegance. You read a function and think, “Oh, that’s clever. That’s the right shape for this problem.” The surprise is pleasant, a small gift from the author.
Boring code never surprises you at all. You read a function and think nothing, because there’s nothing to think about. It does what it says. It says what it does. You move on.
The overlap is significant. Beautiful code often becomes boring over time, as its patterns become familiar. And boring code, when you look closely, often has a quiet beauty to it: the beauty of restraint, of fitting perfectly into a larger system, of not demanding attention.
But they’re not identical. Beauty is how code reads. Boring is how code feels to live with.
The Surprise That Wasn’t
I once worked on a system that tracked usage metrics for billing. Features would report their usage to us, we’d aggregate the numbers, and at the end of the month we’d generate invoices.
The API was clean. The code worked. But we’d made a choice early on that seemed reasonable at the time: we didn’t implement idempotency. If a caller sent the same request twice, we’d record it twice. The thinking was that callers should be responsible for not double-sending.
Then a feature team shipped a bug. Their code would occasionally retry requests that had already succeeded, and each retry created another line item on the invoice. Customers started seeing duplicate charges. They let us know, quickly and loudly. We fixed it, apologized, and moved on.
That one was visible. The next one wasn’t.
A different feature team had a similar issue, but subtler. Their usage tracking stopped resetting at the end of each billing cycle. Every month, the numbers carried forward. A customer who used a hundred units in January and a hundred in February would see two hundred in February’s invoice. Then three hundred in March. Then four hundred.
The invoices were wrong. But worse: the metrics dashboards were wrong too. Customers saw their traffic growing month over month. They thought their marketing was working. They made business decisions based on numbers that were completely fictional.
It took months before someone noticed. A customer reached out asking why their visitors kept going up but their sales never did. That’s when the dominos started falling.
The code had surprised us. Not with cleverness, but with absence. We hadn’t built the boring guardrails: idempotency to prevent duplicates, hard resets to prevent accumulation, alerts to catch impossible growth curves. Idempotency is boring. It’s a solved problem with a standard pattern. We’d chosen something more interesting: trust that callers would behave correctly. That interesting choice cost us months of wrong invoices and broken trust.
Interesting systems fail in interesting ways. Boring systems fail loudly, obviously, and early.
The Stories You Never Tell
When I try to think of specific moments where boring code saved me, I come up empty.
That’s the point.
Boring code doesn’t create war stories. It doesn’t generate incidents. It doesn’t page you at 2 AM. It doesn’t become the subject of postmortems or the villain in retrospectives. It just sits there, doing its job, day after day, while you focus on something else.
The proof of boring code is the absence of drama. The best guardrails are the ones you forget exist until you realize you’ve never fallen. The best conventions are the ones that make wrong code look obviously wrong, so you fix it before it ships. The best APIs are the ones you use correctly on the first try, because there’s only one way to use them and it’s the obvious way.
Stripe’s idempotency keys are boring. You pass a unique key with each request, and if you accidentally send the same request twice, the second one is ignored. There’s no story to tell about the time this saved me, because it saved me dozens of times without me noticing. The duplicates just never happened. The invoices were just correct.
That’s what boring buys you: the luxury of not having to be vigilant. The freedom to think about your actual problem instead of defending against your infrastructure. The quiet confidence that the ground beneath you is solid.
Conventions as Cognitive Shedding
Following conventions isn’t about lack of creativity. It’s about choosing where to spend your limited attention.
Every deviation from convention is a tax. Someone has to learn why you did it differently. Someone has to remember that this part of the codebase doesn’t work like the rest. Someone has to hold the exception in their head while they’re trying to solve the actual problem. These taxes compound. A codebase full of “interesting” choices becomes a codebase that’s exhausting to work in.
Conventions let you shed cognitive load. When the file structure is standard, you don’t have to think about where to put things. When the naming is consistent, you don’t have to think about what to call things. When the patterns are familiar, you don’t have to think about how to structure things. Your brain is freed up for the work that actually matters.
There are times to deviate. Core domain logic, where getting it exactly right is worth the cost of unfamiliarity. High-stakes code, where the boring solution genuinely can’t meet the requirement. Performance-critical paths, where the standard approach isn’t fast enough. But even then, the deviation should be contained, documented, and tested like it’s radioactive.
The default should always be boring. Deviate only with a receipt.
The Shaping
AI doesn’t write boring code.
It writes code that works, usually. Code that’s clever, sometimes. Code that imports three libraries to do what one could handle. Code that uses the latest syntax your team hasn’t adopted yet. Code that over-abstracts, over-generalizes, and looks impressive in ways that don’t match your system. AI wants to be helpful. You have to teach it to be dull.
This isn’t a criticism of AI. It’s doing what it was trained to do: generate plausible code for an unknown context. But your context isn’t unknown. You know your conventions. You know your patterns. You know what boring looks like in your codebase.
So the work is the same as it was in Chapter 10: the human shapes the material. AI generates volume. You refactor it toward boring. You rename the clever abstractions into obvious ones. You flatten the unnecessary layers. You make it look like everything else in the codebase, so the next person who opens it won’t have to think about it.
Boring code is the interface between human intent and machine output. It’s how you teach your tools what you actually need.
The Ground Beneath
The Whitehead quote at the top of this chapter has stayed with me for years. Civilization advances by not having to think about things.
We don’t think about how electricity works when we flip a switch. We don’t think about TCP/IP when we open a browser. We don’t think about the garbage collector when we allocate memory. These are solved problems, built on boring foundations, and their boringness is what lets us build on top of them.
Your code can be part of that foundation. Not every piece of software needs to be interesting. Not every architecture needs to be novel. The goal is not to impress future archaeologists with your cleverness. The goal is to be the solid ground that lets someone else build something that matters.
At 2 AM, when something breaks in production, nobody wants genius. They want predictable. They want the code that does what it says, breaks in expected ways, and can be fixed by someone who’s tired and scared and just wants to go back to sleep.
Write that code. Write the boring code that nobody notices. Write the code that refuses to surprise anyone. Write the code that becomes invisible because it’s so obviously correct that there’s nothing left to question.
The best code is the code you never have to think about.
And if you’re doing it right, you won’t have any stories to tell.