Coding, Documentation, and Style Guidelines

Space
-- Use space liberally, yet sensibly, to make your code readable.
-- Typically there are spaces surrounding operators such as =, +, etc.
-- Use a blank line to separate blocks of code. E.g., a block of code could be a comment and the loop it is describing.
-- Typically there is a blank line before a comment
-- Limit your code and comments to 80 characters per line.
Do NOT allow code or comments to wrap when printed on standard 8.5 by 11 inch paper in portrait mode. Expand tabs to blanks as the default for tabs is eight spaces (too much to indent).

Object-oriented files
Each class should have its own header and implementation file with the same base name as the class (except use uppercase for the class name and lowercase for the filename; for example, class Student, goes with files student.h and student.cpp).

At the beginning of each file (both header and implementation files) describe what the file contains, what the purpose of the class (or other code) is, and what assumptions are made (if any). Give the author name and a brief description of how the code is used.

Function/method comments
-- For each function and method, include a brief description of the purpose. Include pre-conditions and post-conditions (including input and output) when it helps to clarify the function. This should be done both at the declaration and the definition.
-- You must use a line of dashes to separate functions so they can be easily found by the reader.
-- Use additional comments to describe each functional block within a function or method, but typically there are not comments on every line of code.

Public vs. private
-- Methods should be made public only when necessary (that is, they are part of the interface with other modules).
-- Data members should almost never be made public.
-- In most cases, do not circumvent information hiding by using operations that return internal, implementation-dependent data (e.g., pointers or references to data members).

Function/method purpose
Each function or method should perform a single well-defined operation. If your function or method accomplishes two tasks, break it in two functions. This improves the modularity of the code.

Global variables and constants
-- Do not use global variables anywhere in your code. While these are necessary in rare cases, you will not need to use them for any programs in this class.
-- Global constants are acceptable. Global constants are defined in the .h file of the class they go with.
-- Very few numbers appear in the code body. Use constant identifiers!

Consts
-- Use const member functions when possible.
-- When passing by reference use const when possible.