Wednesday, 21 March 2012

Joy of Programming: Why is a Software Glitch Called a ‘Bug’?

There are three things common to every software engineer living in this world: managers, deadlines and bugs! Everyone can understand the first two, but software bugs being a part of one’s life is certainly unique to programmers. All programmers grapple with bugs — they get the software working by avoiding bugs; they debug and fix bugs; they track bugs…
But why is a software glitch called a bug? It certainly is not an insect.
Some people say the word “bug” comes from the old English (Welsh) word “bwg”, which meant a problem or a difficulty; later, it was used to describe defects with machines and then with computers. The word “bug” seems to have caught on with computers because of an incident related to an insect in an early computer.
Mark II was an early electromechanical computer used in the US Navy. On September 9, 1947, when the operators were using the computer to perform calculations, it gave the wrong results. To find out what was going wrong, they opened the computer and looked inside (remember, this was in the “good old days”, and an electro-mechanical computer was in use). And there they found a moth stuck inside the computer, which had caused the malfunction!
The operators promptly removed it and pinned it on the log report, and wrote the following description, “First actual case of bug being found” (see image). They also coined the word “debug”, which meant taking the bug out to get the computer working. Perhaps this might have prompted the well-known computer scientist Edsger W Dijkstra to say (in a lighter vein), “If debugging is the process of removing bugs, then programming must be the process of putting them in.”
Moth that caused the malfunction in the Mark II computer
Moth that caused the malfunction in the Mark II computer
On the same lines, the word “patch”, which means applying a fix for a bug in a program, comes from the old days, when programmers used to fix a program stored on paper tape by using glue and paper!
There are many terms used in software engineering to describe a problem in the software — for example, “defect”, “error”, “malfunction”, “anomaly”, “fault”, “failure”, etc. There are shades of differences in the meanings of these terms. Various standards and organisations define or use these terms in different ways, often causing confusion.
In practice, the most widely used and colloquial term for a software defect is “bug”. Dijkstra called for “…cleaning up our language by no longer calling a bug a bug, but by calling it an error,” because careless or casual use of words such as “bugs” when referring to computer defects takes the seriousness out of defects. However, the word “bug” seems to have caught on, and perhaps it is too late to try changing the terminology.