There is a big difference between the comments of the internal method code and the comments of the API.
For code, I am not familiar with specific practices or layouts. "Use common sense" is the best. Do not document anything that is obvious from the code, etc., but document everything that is not immediately clear. And remember that one thing worse than code without comments is code with outdated comments. Additional comments mean more things that need to be updated.
There are two approaches to API documentation. An all-in-one detail document (proposed by Sun) and more flexible (offering important parts only). In many places, you do not have to document API material, which is obvious from the signature.
While the full documentation of the method (approach to the sun) is important in order to have a well-formed specification, my research shows that this makes it difficult to identify important caveats, which can lead to more errors.
For APIs, see also: Creating Excellent API Documentation: Tools and Techniques
source share