Why is a Software bug called a bug?

As a software engineer, I have been trained to call any problem with my software as a software bug. These are annoying little things which me as a developer had overlooked during programming, or made a mistake in understanding the requirements, or just straight up errors in code.

Most of the times I just call them a feature, and be done with it (hah!), but other times, I have to sit and debug them, checking through every line of code to make sure everything’s as it’s supposed to be.

So as I was toiling away on the code for my habit tracking app, trying to find a weird bug which affected only the users in the region observing Daylight Saving Time, and only if they had made an entry on the date the change in time is observed.

While trying to debug this bug, I learned about the perils of using the Date class in Java, and why we should use the Instant instead. To understand the context of why the Date class was designed the way it was, I tried reading the history of Java on Wikipedia.

Unfortunately, I didn’t find anything about it there, but it lead me to a Wiki walk on the history of computing, which lead me try and figure out the reason why a software bug is called a bug.

Before I tell you that, some history and context is necessary.

Mechanical Relays as Transistors

Before we had transistors for our computers, we had to make do with a mechanical relay for giving us our 0s and 1s. These mechanical relays had a mechanical arm, which moved because of electromagnetic waves created by coils to manipulate the arm.

Yes, this movement wasn’t really the most effective, and can do only 50 switches per second. That’s a 50 Hz processor. Compare that to the machine I am writing on today, which is a 2.4 GHz processor. It means it can switch between two different states roughly 2,400,000,000 times per second.

That’s 4.8 million times faster than Harvard Mark I. Imagine the patience of those programmers (or operators, as they were rightly called back then).

The modern chips use semiconductors to create these kinds of relays (now called a transistor) which don’t have a mechanical arm and can be very very small (or as my snapchat friends call it, small af).

Side effects of Mechanical Relays

Because the relays used were Mechanical in nature, they had a lot of limitations. Some of the limitations were the speed with which they can be switched (remember 50 Hz?). Another was wear and tear, because of which these relays will stop working, or stop working as efficiently as they used to work.

Things like the mechanical arms getting jammed, or being permanently magnetized and stuck, were pretty common and documented problems.

The frequent switching of arms also created friction with the air, because of which a lot of heat was generated. This heat was a problem as it usually hampered the efficient working of mechanical tools, and it attracted – wait for it – BUGS!

First case of Bugs (not Software Bugs though)

On 9th September 1947, Operators traced an error in the Harvard Mark II to a moth trapped in a relay, coining the term bug. This bug was carefully removed and taped to the log book.

First Ever Computer Bug!
A page from the Harvard Mark II electromechanical computer’s log, featuring a dead moth that was removed from the device. The first ever Computer Bug!

The operators who found it, kept the insect with the notation “First actual case of bug being found.”

This log book, complete with attached moth, is part of the collection of the Smithsonian National Museum of American History.

Grace Hopper (who worked on the Harvard Mark II, and invented the first compiler for a computer programming language) noted “From then on, when anything went wrong with the computer, we said it had bugs in it”.

Stemming from the first bug, today we call errors or glitches in a program a bug.

So there you go, the reason why it is called a bug, or now a software bug is because the very first bug was an actual living bug, which caused the problems in functioning of the computer.

That first bug was an actual bug, which made the computer to not work as it should. The process of removing bugs is called debugging, which Hopper and her team had to do quite literally.

Further reading: Wikipedia page on Software Bug, Wikipedia page on Harvard Mark I, and Relays.

Leave a Reply

Your email address will not be published. Required fields are marked *