Zero Defect Programming

A Very Simple Debugging Technique

So how does a programmer ensure his product is correct and reliable? I've been a programmer since 1964; I learned programming very quickly, but it took me several years to learn how to debug. It's hard to find out what a program is actually doing. It would be best if the program told us what it was doing.

There is a simple technique that allows any programmer to approach 100% quality; this technique works with all procedural languages. I have used this technique with Assembler, Cobol, QuickBasic, Visual Basic, C, Pascal, Modula, PL/I, and Fortran.

Basically, it requires a programmer to look at a chunk of code he has just written, take the negative viewpoint, and say to himself: "This isn't going to work. What do I need to know to find out what's wrong with this code?" Then he adds debugging statements to display his variables. Simple, really. The trick is to do this with ALL subroutines, and to do it when the code is written. In languages like Visual Basic and Delphi, which are event-driven, this is particularly important, as code often gets executed in a sequence different from what the programmer expects.

Using this simple technique, your programs will approach the ideal: zero defects. This is because your program will tell you precisely what it is doing when and with what, because you put in sufficient display statements at the start.

If you got to this page via a Search Engine, click here to go to the start.
Send mail to Doug Anderson with questions or comments about this Web site.
Copyright © 1998-2007 Doug Anderson
Last modified: 20 Nov 2007