Debugging Activity

Few programmers get things right the first time. Even after creating an extensive design, we often encounter problems when writing the code. What do you do when your code contains bugs? How do you make sense of the error messages that appear? This assignment is designed to help you become self-sufficient at debugging. By practising debugging skills, you will become more adept at spotting and fixing bugs.

To Do:
Open up the Lightbulb Debugging Assignment. This JavaScript program's functionality is straightforward. The correct code should enable you to turn each lightbulb on or off by clicking on its "on" and "off" switches. Every time this is done, a message appears, indicating how many times that particular lightbulb has been accessed. The master switch at the bottom of the page turns all of the lightbulbs simultaneously on or off.

Your task is to try out the buggy code, taking note of the error messages that appear. Note that not all of the errors will be indicated at the very beginning. This is because some of the bugs prevent some entire functions from executing. Only when the general structure of the function is fixed will more obscure bugs within the function be detected.

Debugging is not an easy task, so don't be frustrated if this assignment takes you awhile to complete. Here are some hints to help you get started.

Debugging techniques:

Finding common errors:

These are just several things to check for when debugging. Of course, debugging is hardly ever this predictible, so you probably encounter many unique situations. As you debug, you will likely develop a plan of attack with which you feel comfortable. Be patient, and good luck!