Close
Register
Close Window

OpenDSA Modules Collection with Slides

Chapter 3 Programming Tutorials

Show Source |    | About   «  3.4. Installing the Web-CAT Submission Plug-in for Eclipse   ::   Contents   ::   3.6. Debugging In Eclipse  »

3.5. Common Debugging Methods

3.5.1. Common Debugging Methods

When tracking down bugs in your code, there are a number of methods that programmers can make use of. These methods all have different strengths, but the main goal of each is to help narrow down where the bugs exist and why they cause problems.

3.5.1.2. Rubber Duck Debugging

Rubber Duck Debugging has become popular through the programming industry. Rubber Duck Debugging focuses on making the programmer carefully examine each line of their code and not just assume that it does what they expect, but explain how it works. In order to use Rubber Duck Debugging a programmer should make use of a rubber duck toy (or any other object to stand in as a person), and then go through each line of their code and explain it to the duck as if it were a normal person with no programming experience. Rubber Duck Debugging is only as effective as the thought put into it, however. When making use of the technique be sure to be thorough in your explanations and to consider every possible case. For an example of Rubber Duck Debugging read this blog.

3.5.1.3. Wolf Fence Debugging

Imagine there is only one wolf in Alaska. How would you find it? The most effective way would be to fence Alaska in half and wait for the wolf to "howl." When you know which half has the wolf split it and again wait. Keep repeating until you find the wolf. This is the basis of Wolf Fence Debugging. Work to find where the bug occurs, eliminating areas repeatedly until the method and then the line of code causing the problem has been found. The method is particularly useful when used in conjunction with Exceptions as the stack trace can show each line of code called leading to the actual Exception being thrown.

   «  3.4. Installing the Web-CAT Submission Plug-in for Eclipse   ::   Contents   ::   3.6. Debugging In Eclipse  »

nsf
Close Window