Code Review

If a professional tennis player noticed that she was missing a lot of backhand volley shots, she would pay particular attention to that part of her game until it improved. You can do the same thing with your programming. You'll never reach the goal of making no mistakes in your programming, but you have an advantage over the tennis player in that you have time to proofread, just as you would read over an exam or a term paper before handing it in to be graded.

As you write successively longer and more complex programs, you should be keeping a record of the most common kinds of mistakes you make. Then, in subsequent programs, you can specifically look for the kinds of mistakes you've made frequently in the past.

You'll be tempted to just hit the "Syntax Check" button or the "Execute" button and have the language do your proofreading for you, but resist this temptation! The simple fact is that you are smarter than the computer. The computer can spot certain kinds of syntax errors, but it can't spot mistakes like this:

(define (area-of-disk radius)
  (* pi radius radius))
(define (area-of-ring inner outer)
   (- (area-of-disk inner) (area-of-disk outer)))
If you read over your own program carefully before hitting the "Syntax Check" or "Execute", you'll find not only syntax errors but more subtle logic errors like the above.
Last modified: Mon Mar 4 13:07:25 EST 2002
Stephen Bloch / sbloch@adelphi.edu