Skip to content
CONTACT

Law of the residual bug

CLASSIC LAWS

Every program contains at least one bug, and every program can be shortened by one instruction. It follows, by induction, that every program can be reduced to a single instruction that doesn't work.

— Anonymous, computing folklore
VIDEO.EXE16:9

It is the fundamental theorem of programming and, like every serious theorem, nobody has ever proved it, because everyone was busy fixing something else. The logic is flawless: remove one line at a time and the bug is always still there, clinging on like a limpet to a rock.

I tried to verify it in the lab. I took a forty-thousand-line management system and started removing lines. When I got down to one, the program printed the date. Wrong. By one day. Only in months with an R in them.

For non-programmers the moral is simple: perfect software exists, but only until somebody writes it. The moment you press the first key, the error takes a seat in the front row and starts taking notes.