Learn the essentials of debugging
The most troubling thing to me is that many students -- and even commercial coders -- seem to freeze when unexpected problems arise. Some literally try making random changes or, worse, try to run the program a few more times in hopes that it will start to work again. These actions illustrate two primary issues: They have no idea how to approach debugging, and they have no confidence that they can nail the problem. I hope to ameliorate the situation by providing a clear approach that programmers can follow, or at least a place to begin.
To expose the debugging process, I need to narrow the focus from the many possible programming problems. Algorithm implementation errors are reasonably easy to track down with a debugger. You can just step through looking for an invalid state or bad data (the last statement to execute either is itself wrong or at least points you at the problem).
Then some truly bizarre problems defy logic. In languages such as C/C++, you might have a buffer overflow situation that wipes out your stack activation record, leading to really unexpected results; the environment itself becomes corrupted in this instance. In the Java language and others like it, this is not possible; however, you can still have bizarre problems. In this article, I will focus on the type of problem where a trivial bit of code that should work, does not.
582 views

Post new comment