The often provocative Chuck Moore (inventor of the Forth language) gave the following advice[1]:
Use comments sparingly! (I bet that's welcome.) Remember that program you looked through - the one with all the comments? How helpful were all those comments? How soon did you quit reading them? Programs are self-documenting, even assembler programs, with a modicum of help from mnemonics. It does no good to say:
LA B . Load A with B
In fact it does positive bad: if I see comments like that I'll quit reading them - and miss the helpful ones. What comments should say is what the program is doing. I have to figure out how it's doing it from the instructions anyway. A comment like this is welcome:
COMMENT SEARCH FOR DAMAGED SHIPMENTS
Should comments say why the program is doing what it is doing?
In addition to the answers below, these two Programmers posts provide additional insight:
- Beginner's guide to writing comments?
- An answer to Why would a company develop an atmosphere which discourage code comments?
###References
1. Programming a problem-oriented-language, end of section 2.4. Charles H. Moore. Written ~June 1970.