Javadoc is the standard when writing Java code. A proper Javadoc should look like this:
/**Everything should be documented so one doesn't have to look at the source code to know what the code does.
* Generate an informational page of this class in the supplied format.
* Valid formats are "html" and "plain".
* @param format The format to create the page in.
* @throws FormatUnknownException If the format supplied by "format" is unknown.
*/
public Page createInfoPage(String format)
{
...
}
To my amazement I found this in the Javadoc supplied by Oracle:
Really? This is not useful at all. How am I supposed to know how to prevent this exception or how do I present this to my users? "Something went wrong?"
- Throws:
NamingException
- if a naming exception is encountered
As a bonus I'm going to leave this here, just something I found when reviewing code as an assignment for school. I just didn't know whether to laugh or to cry.
/**
* Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
Geen opmerkingen:
Een reactie posten