{{Short description|Defect in an engineered system}} {{about|engineering defects in general|defects in computer software|software bug|defects in computer hardware|hardware bug}} [[File:Codebeispiel - Syntax error.png|thumb|A BASIC program failing due to a syntax error in its code]]

In engineering, a '''bug''' is a design defect in an engineered system—such as software, computer hardware, electronics, circuitry or machinery—that causes an undesired result. Defects outside the scope of design, such as a server crash due to a natural disaster, are not bugs, nor do bugs occur in natural systems such as the weather.

''Bug'' is a non-technical term; more formal terms, besides defect, are error, flaw, and fault. Bugs may be persistent, sporadic, intermittent, or transient; in computing, crashes, freezes, and glitches are types of bugs.

Since desirability is subjective, what is undesirable to one may be desirable to another, hence the often comical rejoinder occasionally offered to the report of a bug, "It's not a bug, it's a feature."

== History == The Middle English word ''bugge'' is the basis for the terms ''bugbear'' and ''bugaboo'' as terms used for a monster.<ref>{{cite web |url= http://www.computerworld.com/article/2515435/app-development/moth-in-the-machine--debugging-the-origins-of--bug-.html |title= Moth in the machine: Debugging the origins of 'bug' |author= Computerworld staff |date= September 3, 2011 |work= Computerworld |url-status= live |archiveurl= https://web.archive.org/web/20150825040938/http://www.computerworld.com/article/2515435/app-development/moth-in-the-machine--debugging-the-origins-of--bug-.html |archivedate= August 25, 2015 |df= mdy-all }}</ref>

The term ''bug'' to describe a defect has been engineering jargon since at least as far back as the 1870s, long before electronic computers and computer software. For instance, Thomas Edison wrote the following words in a letter to an associate in 1878:

{{blockquote|It has been just so in all of my inventions. The first step is an intuition, and comes with a burst, then difficulties arise—this thing gives out and [it is] then that "Bugs"—as such little faults and difficulties are called—show themselves and months of intense watching, study and labor are requisite before commercial success or failure is certainly reached.<ref name="Hughes1989">Edison to Puskas, 13 November 1878, Edison papers, Edison National Laboratory, U.S. National Park Service, West Orange, N.J., cited in {{cite book |first= Thomas Parke |last=Hughes |title= American Genesis: A Century of Invention and Technological Enthusiasm, 1870-1970 |url= {{google books |plainurl=y |id=0r-ml88EynYC |page=75}} |year=1989 |publisher= Penguin Books |isbn= 978-0-14-009741-2 |page=75}}</ref>}}

In a comic strip printed in a 1924 telephone industry journal, a naive character hears that a man has a job as a "bug hunter" and gives a gift of a backscratcher. The man replies, "Don't you know that a 'bug hunter' is just a nickname for a repairman?"<ref>Cy Meyn, Hattie the Hello Girl, [http://bh.hallikainen.org/thg/monitor/Monitor_1924-01.pdf The Mountain States Monitor] Vol. XIX, No. 1 (Jan, 1924), Mountain States Telephone and Telegraph Co.; page 34, bottom.</ref>

Baffle Ball, the first mechanical pinball game, was advertised as being "free of bugs" in 1931.<ref name="Baffle Ball">{{cite web |url= http://www.ipdb.org/machine.cgi?gid=129 |title= Baffle Ball |publisher= Internet Pinball Database |quote=(See image of advertisement in reference entry)}}</ref>

Problems with military gear during World War II were referred to as bugs or glitches.<ref name="life1942062925">{{cite magazine |url= https://books.google.com/books?id=KlAEAAAAMBAJ&q=life%20magazine%20june%2029%201942&pg=PA25 |title= Modern Aircraft Carriers are Result of 20 Years of Smart Experimentation |magazine= Life |date= June 29, 1942 |accessdate= November 17, 2011 |page= 25 |url-status= live |archiveurl= https://web.archive.org/web/20130604220016/http://books.google.com/books?id=KlAEAAAAMBAJ&pg=PA25#v=onepage&q&f=true |archivedate= June 4, 2013 |df= mdy-all }}</ref>

In the 1940 film ''Flight Command'', a defect in a piece of direction-finding gear is called a ''bug''.

In a book published in 1942, Louise Dickinson Rich, speaking of a powered ice-cutting machine, said, "Ice sawing was suspended until the creator could be brought in to take the bugs out of his darling."<ref name="oclc_405243">{{Citation |last= Dickinson Rich |first= Louise |year= 1942 |title= We Took to the Woods |page= 93 |publisher= JB Lippincott Co |url= https://books.google.com/books?id=PT0zAQAAIAAJ |lccn= 42024308 |oclc= 405243 |postscript= . |url-status= live |archiveurl= https://web.archive.org/web/20170316164959/https://books.google.com/books?id=PT0zAQAAIAAJ |archivedate= March 16, 2017 |df= mdy-all }}</ref>

Isaac Asimov used the term ''bug'' to relate to issues with a robot in his short story "Catch That Rabbit," published in 1944.

[[File:First Computer Bug, 1947.jpg|thumbnail|250px|A page from the Harvard Mark II electromechanical computer's log, featuring a dead moth that was removed from the device]] U.S. Navy Rear Adm. Grace Hopper, a computer pioneer, popularized a story about a moth that caused a problem in an early electromechanical computer.<ref>{{citation|title=FCAT NRT Test |publisher=Harcourt |date=March 18, 2008 |title-link=Florida Comprehensive Assessment Test }}</ref> While Hopper was working on the Mark II and Mark III as Harvard faculty in about 1947, operators traced an error in the Mark II to a moth trapped in a relay. The moth was removed from the mechanism and taped in a log book with the note "First actual case of bug being found." <ref>{{Cite web |title=Log Book With Computer Bug |url=https://americanhistory.si.edu/collections/nmah_334663 |access-date=2024-08-16 |website=americanhistory.si.edu |language=en}}</ref> Reportedly, the operators, including William "Bill" Burke, later of the Naval Weapons Laboratory, Dahlgren, Virginia,<ref>IEEE Annals of the History of Computing, Vol 22 Issue 1, 2000</ref> were familiar with the engineering term and probably making a pun by conflating the two meanings of ''bug'' (biological and technical). Even if a joke, the story indicates that the term was commonly used in the computer field at that time.<ref>{{cite web |author=James S. Huggins |url=http://www.jamesshuggins.com/h/tek1/first_computer_bug.htm |archive-url=https://web.archive.org/web/20000816023000/http://www.jamesshuggins.com/h/tek1/first_computer_bug.htm |url-status=dead |archive-date=August 16, 2000 |title=First Computer Bug |publisher=Jamesshuggins.com |accessdate=September 24, 2012 }}</ref><ref>"[http://catb.org/jargon/html/B/bug.html Bug] {{webarchive|url=https://web.archive.org/web/20170323213836/http://www.catb.org/jargon/html/B/bug.html |date=March 23, 2017 }}", ''The Jargon File'', ver. 4.4.7. Retrieved June 3, 2010.</ref><ref name="si-bug">"[http://americanhistory.si.edu/collections/search/object/nmah_334663 Log Book With Computer Bug] {{webarchive|url=https://web.archive.org/web/20170323220950/http://americanhistory.si.edu/collections/search/object/nmah_334663 |date=March 23, 2017 }}", National Museum of American History, Smithsonian Institution.</ref><ref>"[https://web.archive.org/web/20000119173039/http://history.navy.mil/photos/images/h96000/h96566kc.htm The First "Computer Bug]", Naval Historical Center. But note the Harvard Mark II computer was not complete until the summer of 1947.</ref> The log book, complete with moth, is part of the collection of the Smithsonian National Museum of American History.<ref name="si-bug" />

The related term ''debug'' also appears to predate its usage in computing: the ''Oxford English Dictionary''{{'}}s etymology of the word contains an attestation from 1945, in the context of aircraft engines.<ref>''Journal of the Royal Aeronautical Society''. 49, 183/2, 1945 "It ranged ... through the stage of type test and flight test and 'debugging' ..."</ref>

=="It's not a bug, it's a feature"== Since ''bug'' implies undesirable behavior, calling out a bug is subjective. What some find a bug others may find a useful feature, hence the familiar phrase, "It's not a bug, it's a feature" (INABIAF).<ref name=wired>{{cite magazine|url=https://www.wired.com/story/its-not-a-bug-its-a-feature/|title='It's Not a Bug, It's a Feature.' Trite—Or Just Right?|magazine=Wired|author=Nicholas Carr}}</ref> This quip is recorded in The Jargon File (1975) but dates at least to 1971, when the PDP-8 programmer Sandra Lee Harris of Digital Equipment Corporation (DEC) made the distinction between issues to be fixed in the code for DEC's FOCAL interpreter and those to be documented or clarified in the user manual.<ref name=focalmanual>{{cite book|url=http://www.bitsavers.org/www.computer.museum.uq.edu.au/pdf/DEC-08-AJAB-D%20PDP-8-I%20FOCAL%20Programming%20Manual.pdf|title=FOCAL Programming Manual for PDP-8, PDP-8/S, PDP-8/I, LAB-8, LINC-8|publisher=Digital Equipment Corporation|id=DEC-08-AJAB-D|year=1968}}</ref>

Such behavior may be explicitly communicated to users or remain undocumented.

==References== {{reflist}}

Category:Engineering concepts Category:Engineering Category:Computer jargon