4.7 Some Stylistic Considerations

In giving names to procedures, the following suggestions provide recommended rules-of-thumb.

1. Use a noun to identify a function procedure returning a value other than Boolean--it names the result of the function. (e.g. CAP, ABS, Gcd)

2. Use an adjective to identify the result of a function procedure that returns a BOOLEAN. (e.g. ODD, Even) It tells if a characteristic of the noun being acted upon is present (is true).

3. Use a verb to identify a regular procedure--it stands for the action being taken. (e.g. WriteChar, WriteString, ReadChar)

4. Start the names of procedures with an upper case letter. This will distinguish them from the names of variable, which should commence with a lower case letter.

Following these suggestions makes programs more understandable--especially when making modifications at a later time.


Contents