Programming Guidelines


The following guidelines are worded strongly. This means exceptions exist, but if you intend to violate one of them then you should have a good reason.
  1. The first line of any file (code or documentation) must include authors name.
  2. The second line of any file must include purpose of file (usually project number).
  3. A file should contain only one class.
  4. Proper indentation is madatory (strongly suggest 3 spaces per block).
  5. Mixing tabs and spaces is unacceptable (just because the indentation looks correct in your application doesn't mean it will be correct when viewed by my application).
  6. Appropriate commenting is necessary (typically should be approximately 20% of the lines of a program).
  7. Comments must be useful (describe pupose of blocks of code not simple translations of single lines).
  8. Use whitespace to increase readability.
  9. Lines should never be longer than 80 characters (preferably 60).
  10. A line should include only one command.
  11. Fields and helper methods should be private (or at least protected).
  12. Methods should be no more than 50 lines (use helper methods).
  13. Methods, variables, and classes should have helpful names (i,j,k for index variables, get/set for accessors/mutators, others should reflect meaning/purpose).
  14. Method, variable, and class names should be capitalized correctly (class names have first letter of every word capitalized, methods/variables have first letter of all but the first word capitalized).
  15. Simple solutions are better than complex ones.
To be continued.