Q From Robert Sterner: What about the origin of a computer bug? My understanding is that one of the first computers (the room-filling monsters) would occasionally short out because a moth or other insect had gotten inside and bridged the gap between two circuits. It might be nice to say more about this, or if it is apocryphal, set it to rights.
A The most common version of this story is that bug results from an incident with the US Navy’s Harvard Mark II computer soon after the end of World War Two, in which a technician cured a fault by extracting a moth from between the contacts of a relay in the system. It is also said that this was the source of debug, the process of finding and removing errors from a computer program.
The incident really did happen: the log book, dated 9 September 1947, survives with the actual moth taped to it and is available online; that page says it happened in 1945 but recent research shows it actually happened two years later.
The log entry itself blows to pieces the story about this being the origin of bug by noting under the insect, “First actual case of bug being found”. This makes it clear that bug for a fault was already in use. Indeed, Rear Admiral Grace Hopper (an early programmer who worked on the machine and who inspired the computer language COBOL) used to tell this story in lectures and would remark that the word was applied to problems in radar electronics in World War II.
It’s actually older still. An early recorded use is in reference to the inventor Thomas Alva Edison and appeared in the Pall Mall Gazette in 1889: “Mr. Edison, I was informed, had been up the two previous nights discovering ‘a bug’ in his phonograph — an expression for solving a difficulty, and implying that some imaginary insect has secreted itself inside and is causing all the trouble”. I've been assured by one of the editors of Edison’s papers that the word was commonly used in his notebooks from the 1870s to describe a problem. It seems it wasn’t new even with him: an electrical handbook of 1896 suggests it had long been used by telegraphers to suggest that electromechanical glitches were caused by bugs getting into the cables.
Debug is also recorded before the moth incident: a writer in the Journal of the Royal Aeronautical Society in 1945 wrote “It ranged from the pre-design development of essential components, through the stage of type test and flight test and ‘debugging’ right through to later development of the engine.”
The story about the moth actually obscures an intriguing item of old American slang.