Documentation Requirements
All program documentation must contain the following elements:
- Header documentation at the beginning of each file that contains:
- the name of the programmer
- the date
- a description of
the purpose of the program or class that is defined in the file
- a clear description of any input expected (especially the
format of a file)
- Meaningful variable, constant, and function names with comments
describing the role of each variable.
- Use of constants for most literal values.
- Documentation before each function or method that contains the
following:
- A brief description of what the function does
- Clear and precise preconditions for the function or method
including
- the state of each parameter before the function or method is
invoked
- the state of the object (if the function or method is part of
a class) before the method is invoked
- Clear and precise postconditions for the function or method including
- the state of each parameter when the function or method returns
- the state of the object (if applicable) when the function or
method returns
- the state of the return value (if there is one)
- Internal comments in appropriate places indicating the state
of relevant variables or describing what the code does.