Some documentation tips that may make programmer fraternity happy:
- Documentation comment should not be more than 80 characters. If it is unavoidable, use paragraphs.
- Create comments for protected and public variables,methods and class.Give them meaningful names, if you do so then you may require less effort in description of your code.
- The first sentence of each documentation comment is a summary sentence (crisp and informative).It contains a concise but complete description of the API item.
- Why a method exists and what it does, this should be documented.Ask any programmer who has to maintain a code with real poor documentation. If you cannot document then do not code and forget about executing it.
- Use 3rd person (descriptive) instead of 2nd person (prescriptive) in the documentation comments.
- While describing a method or a class or an object created from the current class, describe it as given in example: Gets first name of the employee. Instead saying 'This method....'
- Never use JAVADOC style comments inside methods.
- All checked exceptions should be documented with the @throws tag.
- C++ style (// ..) comments should be used for briefly describing a particular statement (preferably place the comment at the end of the statement, in the same line).
- Take full advantage of JAVADOC and HTML tags to significantly improve the readability at HTML levels. Here are some of the HTML tags you can use -
- <UL> This is a bulleted list<li>a bullet point</li></UL>
- <CODE> …</CODE>- Anything that is Java code should be in code tags. E.g java keywords, package names, class names, method names
- <B> - boldify
- <i> - italicize
Purpose of the method
Examples of usage
@param based description of all input parameters
@return based description of the returned value
@throws based description of all the exceptions
@link or @see based reference to all the referred methods
0 comments :
Post a Comment