Style Guide for CS 239 - Spring 2009


This Style Guide should be used as a reference for all work turned in for credit, both labs and programming assignments.  It is based on (but not identical to) standard java coding guidelines.  

Names - All names should be descriptive and readable.  subTotal rather than s; grade rather than grd.  Multiple word names should use either a capital letter separate words (not both).  subTotal. Think about self-documenting code.
Declarations - Where and when to declare variables
Indentation - Indentation provides a visual structure for your program.
Operators
Structure - Structure provides readability
Comments - Comments provide a guide to what the program is doing.  
Class description - every class file must contain a description formatted like the following.
/***************************************************************************
* Overall description of the class goes here
*
* @author Your name goes here
* @version Vn - date (date may be in MM/DD/YY or MM/YY format)
*
***************************************************************************/

Programming Assignments - Every programming assignment must contain the following section which follows the class description or must cite any sources used (such as a TA).
/***************************************************************************
* References and Acknowledgements: I received no outside help with this
* programming assignment
*
 ***************************************************************************/
OR
/***************************************************************************
* References and Acknowledgements: TA Glenn helped me with the foo method.
*
 ***************************************************************************/

This acknowledgement is not necessary for lab assignments.

Methods - All methods must contain a javadoc comment preceding the method header which contains the following if applicable.  Make sure that you do not give an @param or @return tag for methods that take no parameters or which do not return a value.  If the method throws an exception you should also have an @throws tag.
/***************************************************************************
* Overall description of the method goes here
*
* @param paramterName Describe each input parameter, must have one @param line for each
* @return Describe the value that this method returns.
* @throws ExceptionName Describe under what conditions the exception may be thrown

***************************************************************************/

NOTE: In the main class (the class that contains the main method) your method description may reiterate the class description but should contain a detailed description of any arguments being passed into the method.

Miscellaneous