How we change what others think, feel, believe and do
CHAPTER 4 : Commenting
4.2 Comment types
Comments can be used for different purposes in different parts of the program. They fall into one of three categories: header comments, block comments and trailing comments, which describe successively smaller areas of code.
Header comments are used at the start of a major item, acting as an introduction and helping the reader to understand, navigate and use the code beneath it. They are typified by being structured into specified sections (eg. inputs, outputs, etc.) and occupy a number of lines (typically between 10 and 50).
As header comments associate more closely with the code below them, they can be positioned to emphasize this fact.
Header comments are discussed further below, (see 4.3 to 4.5).
Block comments are effectively small-scale headers, describing a small section of code, such as one 'chunk'. They are typified by containing unstructured prose, and occupy few, complete lines (typically between 1 and 5).
They may describe the code above them, summarizing the current status, they may describe the code below detailing what is to happen, or they may combine the two: "All windows are now open, so paint in the forms".
Block comments are discussed further below (see 4.6).
Trailing comments describe the action of one line of code. They typically appear on the same line as the code they describe, although they can appear immediately before or after it. They are typically very brief and are written in the present tense.
And the big