Have you ever asked yourself,
“Why do we call an error a bug?”
That my friend, is a great question and one that actually has a hilarious story behind it, kind of like why you put your kid in footy pajamas backwards funny.
But first let’s talk about what bugs, in the techy world, actually mean.
A bug is an error, failure, fault, or flaw that
occurs in a computer program that makes it produce an incorrect or unexpected result, or behave in a different way than intended.
So anytime you have an error you are encounterting a bug, but how did these errors start being called bugs?
In September 1943, while working on the Mechanical Relay of Harvard Mark II, programmers found their very first programing bug and it was a moth!
They removed it from the system and placed it in the log book pictured below and the name stuck! From that point on any error was referred to as a bug.
This log book, complete with attached moth, is part of the collection of the Smithsonian National Museum of American History.
Now there were other mentions of bugs before this time, such as by Thomas Edison and Ada Byron, however, this instance is what seems to have made it stick in the techy jargon of today.
What is Debugging Then?
Now that you understand what a bug is, let’s talk about how to debug your work as you get started coding.
First off, take a deep breath and accept that you will make mistakes and there will be bugs in your work. Everyone, even super experienced Engineers and Programmers have bugs because that is how we test and learn to make our work better.
Second, know what to look for and take care of your bug as fast as I take care of spiders in my house! With a vaccuum before they scurry away!
The better you are at problem solving through the bugs, the better your code will be and the easier it will be to read for you and others.
Debugging is simply problem solving an error to find the solution to fix it.
Simple enough right? But how do we do this and what steps do we take to look back and find anything that could be causing an issue?
The great news is there are debugging tools that can help find issues and isolate the code that is causing the issue and there are a few steps to get your code all cleaned up and ready to go.
What is the Debugging Process?
There are a few steps you are going to want to do in order to find this buggy problem:
First, you are going to want to reproduce the problem.
Reproducing the problem can be tricky because there may be many factors to consider. Make sure you keep notes of what you have tried during this step to help you figure out what is going on.
Second, describe the bug (what is going wrong) and get as much input from the user as possible.
This input can include the type of browser they used, email provider, and a miriad of other things depending on the software you are debugging.
Third, capture a program snapshot at the moment the error occured.
This allows you to check the variables and state of the program to see what could be causing the issue. This is also where you will analyze what is happening to find out what is causing the bug.
Finally, fix the bug and make sure the fix does not cause another bug.
Fixing the bug that is currently happening is importnat, but remember to look again to make sure that nothing else will be broken if you add the code to fix the current bug. No one likes doing work twice!
Now that you understand what a bug is and how to smash that sucker, tell me what you are going to fix first!
Bug Pics from Katemangostar