Style Guide for CS 159 - Spring 2014


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 standard java coding guidelines.  See http://developers.sun.com/sunstudio/products/archive/whitepapers/java-style.pdf for a complete java guide.

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 to separate words.  subTotal

Declarations - Where and when to declare variables

Indentation - Provides a visual structure for your program.

Literals and Constants

Operators

Structure

Class structure

Comments - Comments provide a guide to what the program is doing.  

Class comment - every source file must contain the following at the top of the class. The * on each line is optional, but you must clearly delineate the class comment from code.
/***************************************************************************
* Overall description of the class goes here
*
* @author Your name goes here
* @version Vn - date
*  Description of the assignment (ex: Lab1, PA1 - Mile conversion)
***************************************************************************/

Programming Assignments - Every programming assignment must contain the following statement or must cite any sources used (such as a TA). This code must come directly beneath the class comment.
/***************************************************************************
* References and Acknowledgements: I received no outside help with this
* programming assignment
*
 ***************************************************************************/
OR
/***************************************************************************
* References and Acknowledgements: TA Glenn helped me with the foo method.
*
***************************************************************************/

Methods comment - All methods must contain a 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. The * on each line is optional, but you must clearly delineate the method documentation from code.
/***************************************************************************
* 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 Describe the exception and condition that would cause it to be thrown
***************************************************************************/