bug:机器里的那只飞蛾

Every programmer knows the word "bug". It means a mistake in a computer program that makes it behave in the wrong way. But why do we use the name of an insect for a software problem? There's a famous story about this. On 9 September 1947, a team of engineers at Harvard University was working on a huge early computer called the Mark II. The machine kept making errors, and when they looked inside, they found the cause: a moth had got trapped in one of the machine's electrical switches. The engineers carefully removed the moth and taped it into their logbook. Next to it, someone wrote: "First actual case of bug being found." The story was later told many times by Grace Hopper, a pioneering computer scientist who worked on the machine, and the logbook – with the moth still in it – is now kept in a museum in Washington. But here's the interesting part. Look closely at the words "first actual case". The engineers were making a joke. They already used "bug" to mean a technical fault, and they thought it was funny that this time, the bug was a real insect. In fact, engineers had been talking about "bugs" for many decades. The famous inventor Thomas Edison used the word in a letter in 1878 to describe small faults and difficulties in his inventions. So the moth didn't create the word "bug". But it did give us one of the best stories in the history of computing – and the phrase "debugging" has been part of every programmer's life ever since.
每个程序员都知道“bug”这个词,它指的是计算机程序里导致程序运行出错的错误。可为什么我们要用一种昆虫的名字来称呼软件问题呢? 关于这个,有一个很出名的故事。1947 年 9 月 9 日,哈佛大学的一个工程师团队正在调试一台叫作“马克二号”的早期巨型计算机。这台机器老是出错,他们打开一看,找到了原因:一只飞蛾卡在了机器的一个电子开关里。 工程师们小心翼翼地把飞蛾取出来,用胶带把它贴在了工作日志里。旁边有人写道:“第一次真的发现了一只虫子(bug)。”后来,参与这台机器工作的计算机科学先驱格蕾丝·霍珀多次讲起这个故事。那本日志——连同里面的飞蛾——如今收藏在华盛顿的一家博物馆里。 但有意思的地方在这里。仔细看看“第一次真的”这几个字。工程师们其实是在开玩笑。他们早就用“bug”来表示技术故障了,觉得这次的“bug”竟然是一只真正的虫子,实在好笑。 事实上,工程师们说“bug”已经说了好几十年。大发明家托马斯·爱迪生在 1878 年的一封信里就用过这个词,用来形容他的发明中的小毛病和小麻烦。 所以,“bug”这个词并不是那只飞蛾创造的。但它确实给我们留下了计算机史上最精彩的故事之一——而从那以后,“debugging”(除错、调试)就成了每个程序员生活的一部分。