1) Document every class, method and attribute
2) For attributes a single line comment is sufficient describing what
it is used for, e.g.
/** used to hold the customer's name */
String name;
3) For methods (including constructors) in addition to describing what the method does you should have a separate @param tag for each parameter and an @return tag if the method returns a value. E.g.
/**
* This method computes the circumference of a circle with
a given radius
*
* @param radius radius of the circle
* @return returns the circumference
*/
float circumference(float radius)
4) Classes should have sufficient comments to describe their
behavior (i.e. a short paragraph). Include the @author tag and the
@version tags.
/**
* This is my class. Here is what it does.
*
* @author Fred Flintstone
* @version 1.0
*/
public class MyClass {
}
5) Remember, JAVADOC comments must come immediately before the class, method, or attribute definition.
6) The key to reuse is good documentation!