views:

96

answers:

3

Which method of commenting is most widely accepted or does it really matter?

I have been using

/**  
 * (Method description)
 * @param
 * @return
 * etc
 */

However I have read of:

Precondition:
Postcondition:

Is there a more 'professional' way of commenting?

Thanks.

+1  A: 

Here are the Java coding conventions for comments recommended by Oracle:

Here are Google's recommendations for their Android platform:

For more detailed information on style and conventions for Javadoc, see here:

Gunslinger47
A: 

The comment style in your first example is not just a convention, it is a standard for a documentation tool called Javadoc. If you follow that Javadoc commenting style, you will be able to easily generate html formatted documentation for all of your source code.

Arnold Spence
A: 

I would simply follow standard defined by Sun (Oracle) for writing Javadoc. Javadoc is referred by all developers unanimously :). For more information click here

I would also ask you to do following search on Stackoverflow for lots of questions and ansers on commenting.

http://stackoverflow.com/search?q=commenting

YoK