Code You Don't Have to Read Twice

Why functional programming is worth learning even if you'll never prove the math behind it, and what the best code in a codebase actually looks like.

August 31, 20262 min read1 / 10

You trust that 1 + 1 = 2 without ever proving it. There's a real, formal proof for that fact, and it's genuinely hard. You've never seen it, and you never needed to.

That's worth sitting with for a second, because it's the whole reason functional programming is worth learning even if the math behind it stays a mystery to you forever.

You Don't Need the Proof to Get the Benefit

Every time you add two numbers, you trust the result completely. You don't re-derive arithmetic from scratch, and you never once wonder if 9 + 10 might not actually be 19 this time.

Functional programming borrows that same kind of trust. A handful of techniques in this series are built on real mathematical guarantees. You won't need to prove any of them yourself. You just need to use them the right way, the same way you use addition without needing to reprove it every time.

The Alternative Is Fumbling Toward an Answer

Compare that trust to how most debugging actually goes: write some code, run it, hope. It fails. Change something. Run it again. Still failing. Add a check. Run it again.

That back-and-forth isn't a personal failing, it's what happens whenever you only partially understand the code you're writing. The fix isn't trying harder. It's writing more code you can actually be certain about before you ever hit run.

The Best Code Is the Code You Didn't Have to Read

Here's the sharpest way to say what this series is actually chasing: the best code in your codebase is the code you never had to read carefully in the first place.

Picture ten thousand lines split into two buckets. Ninety-nine hundred of them behave so predictably that you stop double-checking them at all. The other hundred are the real business logic, the part actually worth your attention every day.

That split is worth wanting. A bug is far easier to find when only a hundred lines could possibly be hiding it, instead of ten thousand.

This series comes back to that exact idea and eventually gives it a real name: surface area, how much of your code you actually have to hold in your head to trust a single line. Shrinking it is most of what functional programming is for.

The Honest Part: It Gets Harder Before It Gets Easier

One more thing worth knowing before you start. The first few functional techniques you try will probably make your code feel less readable for a while, not more.

That's normal. It happens to nearly everyone learning this. Push through the part where it feels worse, and it does turn a corner. This series is written to make that stretch as short as possible.

That's the why. The next thing worth understanding, before any of the specific techniques, is what "readable" even means when code stops looking like a list of instructions.