Bugs are coding errors, flaws or faults in a computer system or program that produce incorrect or unexpected behavior or a different outcome. Debugging is the process of finding and fixing bugs. Most bugs are caused by mistake or error committed in the program’s design, code or component.
Types of bugs
There are a couple of different types of bugs that affect code in different ways. It could be that the coder has simply typed in the instruction incorrectly, or it could be that the coder has given what he thinks is the correct instructions but that the program isn’t doing what he or she intended.
In order to find bugs, you need to familiarise yourself with the program and prepare enough test data. You also have to explore the whole system or program in order to make sure that all the bugs are found. Look for patterns, also. Most bugs stay together because they like to infect the same functionalities. You just have to look at it thoroughly and run as many tests as you can in order to eliminate all bugs infecting your code.
Remember when Mrs. Mully’s cat was lost in the forest? Roopert and his friends went fast into the forest to look for it. Peter stood on the hilltop and used his arms to give instructions on which way to send the robots into the forest maze.
At one point, Peter told the robots to take 4 steps to the left but he should have told them to take 4 steps to the right. This resulted in disaster for Jayson who ended up soggy and unhappy. Out popped Ronnie bug!
At another point, Peter instructed Eksemel to take 4 left turns. Peter had thought this route was a rectangular shape but it was a square shape and sent Eksemel right back to the beginning. Out popped Reggie bug!
Finding the bug
In order to debug (or remove the bugs), Peter took another look at the instructions he was providing. He could see that he sent Jayson the wrong way. He could see that there was an extra path that he hadn’t seen before which meant his instruction to Eksemel did not send her where he had intended her to go.
When he corrected the instructions, he was able to direct Eksemel to the right place.