RossNet

FunnelWeb

Reference

Developer

Tutorial
1 Introduction
2 Macros
3 Typesetting
4 Example
5 Hints
6 Examples
7 Webmaking

SEARCH
FunnelWeb Tutorial Manual

5.12 Wholistic Debugging

Surprising though it may be, FunnelWeb has a role to play in the debugging of programs. My experience in programming has led me to the concept of wholistic debugging. When many programmers detect a bug, their first reaction seems to be to jump into the debugger where they often spend many hours stepping through endless stretches of code and generally wasting a lot of time.

In contrast, my first reaction when I detect a bug is to realize that the code must not be in good enough shape if such a bug can arise! The presence of the bug is taken as symptomatic of the lack of general health of the code. If that bug occurred, why not another? In response to this realization, my reaction is not to enter the debugger, but rather to return to the original code and tend it like a garden, adding more comments, reworking the weaker parts, adding assertions, and looking for faults. In many cases, the search for faults does not even centre on the specific bug that arose, but does tend to focus on the area of code where the bug is likely to be.

The result is often that the original bug is located more quickly than it would have been had the debugger been involved. But even if it isn't, there are other benefits. A programmer who enters the debugger may stay there for hours and still not find the bug. The result is frustration and no positive gain at all. In contrast, by tending to the code, the programmer is making forward progress at all times (the code is constantly improving) even if the bug is not immediately found. At the end of ten hours, the programmer can at least feel that the code is "ten hours better", whereas the debugger freak will likely feel defeated. All this makes code tending better psychologically as well as a more efficient approach to debugging.

I call this technique wholistic debugging, for it is like the difference between conventional and wholistic medicine. Go to a conventional doctor with a headache and he might send off for head X-rays, perform allergy tests and perform many other debugging activities. Go to a wholistic doctor with the same problem and he might look to see if you are fit, assess your mental health, and ask you if your marriage is working. Both approaches are appropriate at different times, but I believe that, on balance, in programming the wholistic approach is not used enough.

Prev Up Next


Webmaster    Copyright © Ross N. Williams 1992,1999. All rights reserved.