Java code commenting on best practices

I finished the Java / Android project, and now I need to comment on the codes (mainly classes and important methods).

I need to do this, following the best industry standards, since later, if someone else needs to be modified, he must shoot forward well.

I read a lot of articles and found 3 main types of java comment styles.

  • Single comment (// .....)
  • Block comments (/ * ....... * /)
  • Doc comments (/ ** ....... * /)

I read mainly about options 2 and 3. Discussion

So, I thought to get around the second option, since I do not need to create HTML documents, since these classes will not be used by other people, and this is the implementation of this application.

I wonder what are the best methods in block commenting that indicate the type of “return”, “parameters”, and “description description” of a method or class.

I would like to hear the best industry standards for commenting on java code.

Thanks in advance...!!!

+4
source share
3 answers

I would recommend switching to the third option, because if someone looks at your code, for example, through an IDE that supports JavaDOC (e.g. Eclipse), it will show relevant information about the objects that he / she examines when he / she hovers over an element that interests him.

, , , , , , , .

/ JavaDOC-, @see.

DOC , DOC, JavaDOC HTML. DOC, , , 1 , , .

+4

API javadoc/**... */

//

/*... */

+2

Javadoc javadoc ( ). :

  • , java-.
  • IDE javadoc . IDE .
  • HTML , , .
  • " ", .
  • , API . API Javadoc, .

. .

+1
source

Source: https://habr.com/ru/post/1534812/


All Articles