| 1 |
|
| 2 |
<HTML> |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
<HEAD> |
| 29 |
<TITLE>5.12 Wholistic Debugging</TITLE> |
| 30 |
<STYLE TYPE="text/css"> <!-- A {text-decoration: none} // --> </STYLE> |
| 31 |
</HEAD> |
| 32 |
<BODY BACKGROUND="binary/background.gif" |
| 33 |
BGCOLOR="#FFFFFF" |
| 34 |
TEXT="#000000" |
| 35 |
VLINK="#660000" |
| 36 |
LINK="#FF0000" |
| 37 |
ALINK="#CC0000"> |
| 38 |
|
| 39 |
<TABLE WIDTH="490"> |
| 40 |
<TR> |
| 41 |
<TD WIDTH="130" VALIGN="top"> |
| 42 |
<IMG SRC="binary/d_clear.gif" ALT="" WIDTH="130" HEIGHT="1"><BR> |
| 43 |
|
| 44 |
<FONT SIZE="2"> |
| 45 |
<BR> |
| 46 |
|
| 47 |
<A HREF="http://www.ross.net/" |
| 48 |
TARGET="rosshome" |
| 49 |
onClick="window.open('','rosshome','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 50 |
> |
| 51 |
<IMG SRC="binary/rossnet_logo.gif" |
| 52 |
WIDTH="64" HEIGHT="32" |
| 53 |
BORDER="0" ALT="RossNet" |
| 54 |
HSPACE="0" VSPACE="1"></A><BR> |
| 55 |
<BR> |
| 56 |
|
| 57 |
<A HREF="../index.shtml" |
| 58 |
TARGET="funnelweb" |
| 59 |
onClick="window.open('','funnelweb','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 60 |
> |
| 61 |
<IMG SRC="binary/linklogo.gif" |
| 62 |
WIDTH="64" HEIGHT="32" |
| 63 |
BORDER="0" ALT="FunnelWeb" |
| 64 |
HSPACE="0" VSPACE="1"></A><BR> |
| 65 |
<BR> |
| 66 |
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD BGCOLOR="#000000"> |
| 67 |
<A HREF="../reference/index.html" |
| 68 |
TARGET="funnelwebreference" |
| 69 |
onClick="window.open('','funnelwebreference','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 70 |
><FONT COLOR="#FFFFFF"><B>Reference</B></FONT></A><BR> |
| 71 |
<BR> |
| 72 |
<A HREF="../developer/index.html" |
| 73 |
TARGET="funnelwebdeveloper" |
| 74 |
onClick="window.open('','funnelwebdeveloper','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 75 |
><FONT COLOR="#FFFFFF"><B>Developer</B></FONT></A><BR> |
| 76 |
<BR> |
| 77 |
<A HREF="index.html"><FONT COLOR="#FFFFFF"><B>Tutorial</B></FONT></A><BR> |
| 78 |
<A HREF="intro.html"><FONT COLOR="#FFFFFF">1 Introduction</FONT></A><BR> |
| 79 |
<A HREF="macro.html"><FONT COLOR="#FFFFFF">2 Macros</FONT></A><BR> |
| 80 |
<A HREF="type.html"><FONT COLOR="#FFFFFF">3 Typesetting</FONT></A><BR> |
| 81 |
<A HREF="example.html"><FONT COLOR="#FFFFFF">4 Example</FONT></A><BR> |
| 82 |
<A HREF="hints.html"><FONT COLOR="#FFFFFF">5 Hints</FONT></A><BR> |
| 83 |
<A HREF="examples.html"><FONT COLOR="#FFFFFF">6 Examples</FONT></A><BR> |
| 84 |
<A HREF="web.html"><FONT COLOR="#FFFFFF">7 Webmaking</FONT></A><BR> |
| 85 |
|
| 86 |
<BR> |
| 87 |
<A HREF="search.html"><FONT COLOR="#FFFFFF"><B>SEARCH</B></FONT></A><BR> |
| 88 |
</FONT> |
| 89 |
</TD></TR></TABLE> |
| 90 |
|
| 91 |
|
| 92 |
</TD> |
| 93 |
<TD WIDTH="360" VALIGN="top"> |
| 94 |
<FONT SIZE="3"> |
| 95 |
|
| 96 |
|
| 97 |
<A HREF="../reference/index.html"><IMG SRC="binary/title.gif" |
| 98 |
WIDTH="302" HEIGHT="24" |
| 99 |
BORDER="0" ALT="FunnelWeb Tutorial Manual" |
| 100 |
HSPACE="0" VSPACE="0"></A> |
| 101 |
<P><FONT SIZE="5">5.12 Wholistic Debugging</FONT><BR> |
| 102 |
|
| 103 |
|
| 104 |
<P>Surprising though it may be, FunnelWeb has a role |
| 105 |
to play in the <STRONG>debugging</STRONG> of programs. My |
| 106 |
experience in programming has led me to the concept of |
| 107 |
<STRONG>wholistic debugging</STRONG>. When many programmers |
| 108 |
detect a bug, their first reaction seems to be to jump into |
| 109 |
the debugger where they often spend many |
| 110 |
hours stepping through endless stretches of code and |
| 111 |
generally wasting a lot of time. |
| 112 |
|
| 113 |
<P>In contrast, my first reaction when I detect a bug is |
| 114 |
to realize that <STRONG>the code must not be in good enough |
| 115 |
shape if such a bug can arise!</STRONG> The presence of the bug is |
| 116 |
taken as symptomatic of the lack of general health of the |
| 117 |
code. If that bug occurred, why not another? In response to |
| 118 |
this realization, my reaction is not to enter the debugger, |
| 119 |
but rather to return to the original code and tend it like a |
| 120 |
garden, adding more comments, |
| 121 |
reworking the weaker parts, adding assertions, and looking |
| 122 |
for faults. In many cases, the search for faults does not |
| 123 |
even centre on the specific bug that arose, but does tend to |
| 124 |
focus on the area of code where the bug is likely to be. |
| 125 |
|
| 126 |
<P>The result is often that the original bug is located |
| 127 |
more quickly than it would have been had the debugger been |
| 128 |
involved. But even if it isn't, there are other benefits. A |
| 129 |
programmer who enters the debugger may stay there for hours |
| 130 |
and still not find the bug. The result is frustration and no |
| 131 |
positive gain at all. In contrast, by tending to the code, |
| 132 |
the programmer is making forward progress at all times (the |
| 133 |
code is constantly improving) even if the bug is not |
| 134 |
immediately found. At the end of ten hours, the programmer |
| 135 |
can at least feel that the code is "ten hours |
| 136 |
better", whereas the debugger freak will likely feel |
| 137 |
defeated. All this makes code tending better psychologically |
| 138 |
as well as a more efficient approach to debugging. |
| 139 |
|
| 140 |
<P>I call this technique wholistic debugging, for it is |
| 141 |
like the difference between conventional and wholistic |
| 142 |
medicine. Go to a conventional |
| 143 |
doctor with a headache and he might send off for head |
| 144 |
X-rays, perform allergy tests and perform many other |
| 145 |
debugging activities. Go to a wholistic doctor with the same |
| 146 |
problem and he might look to see if you are fit, assess your |
| 147 |
mental health, and ask you if your marriage is working. Both |
| 148 |
approaches are appropriate at different times, but I believe |
| 149 |
that, on balance, in programming the wholistic approach is |
| 150 |
not used enough. |
| 151 |
|
| 152 |
|
| 153 |
<P> |
| 154 |
<TABLE WIDTH="100%"> |
| 155 |
<TR> |
| 156 |
<TD ALIGN="left" VALIGN="bottom"><A HREF="hints_dangers.html"><IMG SRC="binary/fw_left.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Prev"></A></TD> |
| 157 |
<TD ALIGN="center" VALIGN="bottom"><A HREF="hints.html"><IMG SRC="binary/fw_up.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Up"></A></TD> |
| 158 |
<TD ALIGN="right" VALIGN="bottom"><A HREF="hints_tabs.html"><IMG SRC="binary/fw_right.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Next"></A></TD> |
| 159 |
</TR> |
| 160 |
</TABLE> |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<HR> |
| 165 |
<FONT SIZE="2"> |
| 166 |
<A HREF="mailto:[email protected]">Webmaster</A> |
| 167 |
<A HREF="copyright.html">Copyright © Ross N. Williams 1992,1999. All rights reserved.</A><BR> |
| 168 |
</FONT> |
| 169 |
|
| 170 |
</FONT> |
| 171 |
</TD> |
| 172 |
</TR> |
| 173 |
</TABLE> |
| 174 |
|
| 175 |
|
| 176 |
</BODY> |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
</HTML> |