01

A bug is a mismatch

A software bug is any difference between what a program does and what its makers intended. It might be a typing slip, a misunderstood requirement or a situation nobody imagined. The word predates computers; engineers spoke of bugs in machinery in the nineteenth century. Its most famous moment came in 1947, when operators of the Harvard Mark II found a moth trapped in a relay and taped it into the logbook as the first actual case of a bug being found. Most bugs are harmless: a misaligned button, a slow screen. A few are serious, leaking data, corrupting files or crashing systems that people depend on.

02

Why errors are inevitable

A modern phone app may contain hundreds of thousands of lines of code, and an operating system tens of millions. Each line must be exactly right, and each interacts with others in ways that multiply. On top of that, programs run on different devices, languages, time zones and network conditions, with users doing things designers never expected. Consider a release containing 1,000 independent changes, each with just a 0.1 per cent chance of introducing a fault. The chance that at least one goes wrong is about 63 per cent. Programmers are not careless; the sheer number of possibilities makes perfection unrealistic, so the industry plans for errors instead of pretending to avoid them.

03

Testing at every level

The first defence is testing, much of it automated. Unit tests check small pieces in isolation: given this input, does this function return that answer? Integration tests check that pieces work together, and end-to-end tests drive the whole application as a user would. Large projects run many thousands of tests every time someone changes the code, and the change is rejected if any fail. Testing has a limit, famously summed up by the computer scientist Edsger Dijkstra: it can show the presence of bugs, never their absence. No test suite covers every possible input, which is why other defences sit alongside it.

04

Second pairs of eyes

In most professional teams, no change goes in until another programmer has read it. Code review catches logic errors, unclear naming and risky shortcuts, and spreads knowledge so that more than one person understands each part. Automated tools add another layer, scanning code for patterns known to cause trouble, such as using data before checking it. Some languages are designed to rule out whole categories of mistake, refusing to run code that might, for example, read memory it should not. For the most critical systems, such as aircraft controls and railway signalling, engineers sometimes use formal methods: mathematical proofs that a piece of software meets its specification.

05

Release slowly, watch closely

Even well-tested software meets surprises in the real world, so large services release changes gradually. A new version may go first to staff, then to one per cent of users, then ten per cent, while monitoring watches error rates, crashes and speed. If anything looks wrong, the change is switched off or rolled back before most people notice. This approach, often called a staged or canary release after the birds once used to warn miners of gas, turns a potential global outage into a small, contained incident. Many features are also built behind switches, so they can be turned off instantly without releasing new code.

06

When bugs slip through

Some failures show what is at stake. In 1996 the first Ariane 5 rocket broke up about 40 seconds after launch because reused software tried to squeeze a number too large into a space too small. The error had been harmless on the older, slower Ariane 4. In 2024 a faulty update to a widely used security product crashed millions of Windows computers worldwide, grounding flights and disrupting hospitals, partly because it reached every machine at once. The lessons are consistent: assumptions must be rechecked when conditions change, and no update should reach everyone simultaneously. Bugs cannot be eliminated, but their damage can be limited.

FOLLOW THE EVIDENCE

Sources & further reading

Figures are rounded and widely published; check the linked organisations for the latest editions. These organisations do not endorse this website.