Style Guide for CS 239

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 a capital letter to separate words (e.g. subTotal). Code should be self-documenting.

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).  You should either include this statement in all files or minimally it may appear in the file containing your main method.

        /**********************************************************************
	* 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 as shown in the example below.   The description should describe the "black box" behavior of the method (what it does).  If there are parameters, then there must be one @param tag for each parameter in the format shown below.  If there is a return value, there must be one @return tag which describes the return value (not the variable name).  Finally, if the method throws one or more exceptions, @throws tags must be used to describe the circumstances under which each exception will be thrown.

      /**********************************************************************
      * Overall description (black box behavior) of the method goes here
      * @param parameterName Describe each input parameter. You must have one
      * @param line for each parameter
      * @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 application via the command line arguments.

Miscellaneous



This style guide is adapted from Nancy Harris's CS239 Style Guide.