An error in a computer program is often referred to as a “bug“. Legend has it that this dates back to early computers (large electromechanical machines that could easily fill a room), which insects could fly into, causing the machine to malfunction.
Figure 1: The first “Computer bug” from Wikimedia Commons used under [Public Domain]
Bugs and debuggers
Nowadays most errors in programs are a result of mistakes made by programmers, and most programmers spend considerable time looking for errors in their own and other people’s program code. If the error is syntactical (such as a misspelt word) the compiler will flag the error. However, if the mistake is semantical (for example the programmer’s logic is wrong) this can be very difficult to find. To aid in the process of debugging (finding semantical errors) some powerful software tools called debuggers have been developed.
Debuggers are also useful for new programmers because they enable beginners to run their programs methodically, and watch as each statement is executed. This allows for a better understanding of what exactly their code does (a bit like playing a video in slow motion).
A downloadable ‘Debugging help sheet’ is available in the next step. When you have a chance, use it to watch a correct program working, and keep it to hand for when you get an error in your code that you just can’t find.
© University of Reading