8
1.4
Debugging and development methodologies
1.4
Once again, a book addressing object-oriented debugging, whatever that
might be, is notably lacking.
Debugging and development methodologies
The other phases of software development were amenable to the structured
and object-oriented approaches. Why wasn't the same true of debugging?
There are at least three reasons.
1.4.1
1.4.2
.
.
There is a big difference between constructive versus cognitive
activities.
Debugging is widely confused with testing.
The supporting disciplines needed for structured and object-
oriented debugging developed much later.
Constructive versus cognitive activities
Coding, designing, analyzing, and testing are all constructive activities.
They each produce a tangible result. Coding produces source code. Design-
ing produces design documents. Analysis produces a variety of documents,
depending on the methodology used. Testing produces test cases and
reports on the success or failure of tests.
In contrast, debugging is primarily a cognitive activity. The end result is
knowledge of why there is a problem and what must be done to correct it.
There will be a source change, but it may only involve adding or deleting a
single character or word. The constructive output of debugging is often dis-
proportionate to the effort expended.
Confusing testing and debugging
Most books and papers written in the 1960s and 1970s confuse debug-
ging with testing. When they talk about debugging, they're really discuss-
ing testing.
One of the earliest books to properly define testing was Glenford
Myers's [My79]
The Art of Software Testing.
Testing is the process of executing a program with the intent of find-
ing errors.
1.4
Debugging and development methodologies 9
In his book, Myers was concerned with debunking definitions such as
the following: "Testing is the process of demonstrating that errors are not
present."
This definition, and other similar ones, all define testing negatively, in
terms of the absence of errors. It's impossible to prove the absence of any-
thing in general. In the particular case of software, it's even more pointless
because large useful software systems all contain defects.
Myers defines debugging as follows:
Debugging is a two-part process; it begins with some indication of
the existence of an error.., and it is the activity of (1) determining
the exact nature and location of the suspected error within the pro-
gram and (2) fixing or repairing the error.
I .4.3
Following Myers's lead, we further refine the definition of software test-
ing to contrast it with software debugging.
Testing is the process of determining
whether
a given set of inputs causes
an unacceptable behavior in a program.
Debugging is the process of determining
why
a given set of inputs causes
an unacceptable behavior in a program and
what
must be changed to cause
the behavior to be acceptable.
The lack of a clear definition of the goals of the testing and debugging
processes prevented the development of a discipline of structured or object-
oriented debugging.
Supporting disciplines developed later
The cognitive psychology of human error, induction, and deduction did
not become widely understood until the early 1990s. The following are
some key texts in each of these areas:
9 Human Error,
James Reason, 1990.
9 Induction: Processes of Inference, Learning, and Discovery,
J. H. Hol-
land et al., 1989.
9 Deduction,
E N. Johnson-Laird and R. M. J. Byrne, 1989.
I Chapter I

Get Debugging by Thinking now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.