2012 : WHAT IS YOUR FAVORITE DEEP, ELEGANT, OR BEAUTIFUL EXPLANATION? [1]

marti_hearst's picture [5]
Computer Scientist, UC Berkeley, School of Information; Author, Search User Interfaces

Why Programs Have Bugs

From the earliest days of computer programming up through the present, we are faced with the unfortunate reality that the field does not know how to design error-free programs.

Why can't we tame the writing of computer programs to emulate the successes of other areas of engineering? Perhaps the most lyrical thinker to address this question is Fred Brooks, author most famously of the "The Mythical Man-Month."(If one bears in mind that this unfortunately titled book was first published in 1975, it is a bit easier to ignore the sexist language that litters this otherwise fine work; the points Brooks made more than 35 years ago are almost all accurate today except the assumption that all programmers are "he".)

When espousing the joys of programming, Brooks writes:

"The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures. ... Yet the program construct, unlike the poet's words, is real in the sense that it moves and works, producing visible outputs separate from the construct itself. It prints results, draws pictures, produces sounds, moves arms. The magic of myth and legend has come true in our time."

But this magic comes with the bite of its flip side:

"In many creative activities the medium of execution is intractable. Lumber splits; paints smear; electrical circuits ring. These physical limitations of the medium constrain the ideas that may be expressed, and they also create unexpected difficulties in the implementation.

... Computer programming, however, creates with an exceedingly tractable medium. The programmer builds from pure thought-stuff: concepts and very flexible representations thereof. Because the medium is tractable, we expect few difficulties in implementation; hence our pervasive optimism. Because our ideas are faulty, we have bugs; henour optimism is unjustified."

Just as there is an arbitrarily large number of ways to arrange the words in an essay, a staggering variety of different programs can be written to perform the same function. The universe of possibility is too wide open, too unconstrained, to permit elimination of errors.

There are additional compelling causes of programming errors, most importantly the complexiting of autonomously interacting independent systems with unpredictable inputs, often driven by even more unpredictable human actions interconnected on a world wide network. But in my view the beautfiul explanation is the one about unfettered thought-stuff.