Coding Standards

The following coding standards were used for an earlier course.  You are not obligated to use these standards, but you should develop and maintain some reasonable set of standards and stick with them.

  1. Each source module will contain at most ten procedures of similar function (as indicated by the module name).  The procedures within a module must be separated by several blank lines.
  2. Each procedure will contain a header comment identifying the procedure by name and function.
  3. Each procedure will contain at most 100 lines of executable code, not counting comments or declarations.
  4. Use variable names which are meaningful.
  5. No comment will continue across line boundaries.  Close the comment at the end of a line and open it again on the next line.
  6. At most one statement will occur on a line.  If a statement spans several lines, it will be indented in a consistent fashion (to indicate continuation).
  7. Blank lines and extra spaces will be used freely to increase readability.  In particular, the assignment operator (=) will always be enclosed in spaces.  Use parentheses for clarity.
  8. The use of the GOTO statement is very strongly discouraged.
  9. No string constant will be split between two lines.
  10. No code may succeed a `{' nor precede a `}' on a line.
  11. All programs will be indented in the following manner:

Dan Hirschberg
Computer Science Department
University of California, Irvine, CA 92697-3435
dan (at)
Last modified: Mar 22, 1999