Commenting While You Code

Good comments are a pleasant surprise for anyone who's ever tried to revise someone else's program. Not too long ago, I landed a contract writing a guide for a new, company-internal programming language. Was there a spec? No. Were there sample programs? Not really. Comments in the source code? No—strike three. The lead developer and I spent a lot more time with each other than with our families for a number of weeks—good thing we got along. But why take that chance? Better to write your comments as you go. Here are some ways to structure comments within a procedure: