Dr. Taylor's Java Documentation Standards

All source code submitted to Dr. Taylor should meet the minimum documentation standards outlined below.

  • The beginning of each source file should contain:
    • The name of the file/class.
    • The date it was originally written.
    • The original author.
    • A modification log (when appropriate) which describes:
      • What modifications were made.
      • When the modifications were made.
      • Who made the modifications.
  • All Java classes must have a "class description" comment in javadoc style with @version and @author tags.
  • All fields must be declared individually and have an associated javadoc comment.
  • All methods must be proceeded by a javadoc comment that makes appropriate use of the following tags:
    • @author
    • @param
    • @return
    • @throws
    • @see
  • Within each method, documentation should be provided for any code whose purpose is not immediately obvious to someone with your current level of programming knowledge.

Example

/* 
 * Course: CS1020
 * Section: 1
 * Term: Fall 2005
 * Author: 
 * Assignment: Lab 1
 * Date: 09/09/05
 */

package blah;

import java.blah.blahdy.BlahBlah;

/**
 * Class description goes here.
 *
 * @version    1.82 18 Mar 1999
 * @author     Firstname Lastname
 */
public class Blah extends SomeClass {
    /* A class implementation comment can go here. */


    /** classVar1 documentation comment */
    public static int classVar1;

    /**
     * classVar2 documentation comment that happens to be
     * more than one line long
     */
    private static Object classVar2;

    /** instanceVar1 documentation comment */
    public Object instanceVar1;

    /** instanceVar2 documentation comment */
    protected int instanceVar2;

    /** instanceVar3 documentation comment */
    private Object[] instanceVar3;

    /**
     * ...constructor Blah documentation comment...
     * @author 
     */
    public Blah() {
        // ...implementation goes here...
    }

    /**
     * ...method doSomething documentation comment...
     * @author 
     */
    public void doSomething() {
        // ...implementation goes here...
    }

    /**
     * ...method doSomethingElse documentation comment...
     * @author 
     * @param someParam description
     * @return Returns the number of widgets
     */
    public int doSomethingElse(Object someParam) {
        // ...implementation goes here...
        return i;
    }
}

A more extensive example is also available.

  • © 2001-2008 Dr. Christopher C. Taylor •
  • Office: L-343 •
  • Phone: 277-7339 •
  • npǝ˙ǝosɯ@ɹolʎɐʇ