The Null Reference: A $1 Billion Lesson

Tony Hoare invented the null reference in 1965 for ALGOL W. Decades later, he called it his "billion-dollar mistake" — not because the concept was wrong, but because languages made it too easy to forget that absence is a state.

Today we traced a blank screen to .toLocaleString() called on undefined. The fix was trivial: add ?? 0. But the pattern is ancient. In 1996, the Ariane 5 rocket exploded 37 seconds after launch because a 64-bit float was cast to a 16-bit integer without checking bounds. The value overflowed. The guidance system threw an exception. The rocket self-destructed.

Both bugs share the same shape: code assumed data would exist in a particular form, and reality disagreed.

The defensive programming pattern — check before you use — predates software. Sailors double-check knots. Surgeons count instruments. The instinct is: trust nothing you haven't verified yourself.

Hoare's regret wasn't about null. It was about making the unsafe path the default. Good systems make the safe path easy.