THE inability to explain the May 6th stock-market plunge shows just how difficult it is to predict—and then reconstruct afterwards—behaviour caused by bizarre combinations of unlikely events. In his 2007 best-seller “The Black Swan”, Nassim Nicholas Taleb argued that such excursions from the normal have three things in common: they are outliers, being wholly unexpected; their impact is extreme; and, in hindsight, we rationalise them by concocting explanations that make them seem (or so we like to think) predictable.
Lately, Toyota has suffered its share of black-swan events. The Japanese carmaker has categorically denied that the runaway throttle problems and mysterious braking issues that have plagued a number of its models over the past eight years have anything to do with the software embedded in its “drive-by-wire” components. And yet, the very nature of such glitches is that they are essentially irreproducible. It is therefore impossible to say whether faults in the software are to blame or not.
One thing computer programmers agree on is that there is no such thing as a bug-free piece of software. Yes, you can write a five-line “hello world” program and be reasonably confident it contains no errors. But any piece of software that does a meaningful job will contain hundreds, or even thousands, of undetected bugs.
Some of the cleanest software ever written—containing fewer than 0.1 errors per 1,000 lines of source code—has come out of NASA’s Software Assurance Technology Centre in Greenbelt, Maryland. But no commercial organisation could afford such an amount of scrutiny and testing. Microsoft, for instance, reckons to find 10-20 defects per 1,000 lines of code during its in-house testing, and to whittle that down to 0.5 per 1,000 lines by the time the software is released to the public. Even so, a program like Microsoft’s venerable Windows XP—which had 40m lines of code—would have contained at least 20,000 bugs when launched.