CMPS203 Programming Standards
Every program you submit as part of this class must adhere to the
following standards.
- Every file should start with a block comment containing the
name(s) of the author(s), and a description of what the
code in the file does. The comment should stand on its own. Don't
simply write "Homework 1". Instead write a brief description (it
need not be a full specification, e.g. "This class implements the
beginnings of a rudimentary board for the game of 'Go'. It is capable
of computing and displaying the liberties for a given board
configuration."
- Before submitting any source file, replace all tabs with the
appropriate number of space characters. You can use the Unix
command expand if your editor does not support using spaces instead
of tabs.
- Make sure your program is nicely and consistently indented. I do
not prescribe a particular indenting style except that you should
indent 2-4 spaces for each nested construct/block.
- Use descriptive variable names. Single letter variable names are
not acceptable with the exception of the traditional i, j, k for
loop indicies used solely to count iterations or index into an
array.
- EVERY function or method must be preceded by a block comment
listing briefly the purpose of the function, the input parameters,
and the output parameters. For extra credit consider including pre
and post conditions as well on each function or method.
- Avoid long functions/methods. 25 is a good target, 50 is getting very long.
- Try to limit lines to 80 characters. In no case should a line exceed 100
characters. Make sure your editor is not doing some auto-"magic" line wrapping of long lines.
- No magic numbers (literal numeric constants). The exceptions are 0, 1,
and -1, and of course the literals used to initialize symbolic constants.
This page maintained by Charlie McDowell.
Email regarding this site.