The Sun Java Code Conventions document, written in 1997, and available at http://java.sun.com/docs/codeconv/, continues to be a valuable resource for Java programmers. In addition to the nuts and bolts of formatting and the like, it includes some great wisdom, such as:
The frequency of comments sometimes reflects poor quality of code. When you feel compelled to add a comment, consider rewriting the code to make it clearer.
I’ve recently been asked to participate on a committee that will come up with a set of coding standards. These standards will be used by several teams, so it’s especially important that they be good and not overly restrictive. The Sun conventions are a reasonable place we may start. On the whole, I think they’re great, but I do have some reservations about a few points. Below are some notes regarding the Sun conventions, listed by section in the original document to which they refer. Quotes from the Sun document are indicated in italics, except for source code. I invite your feedback. This article may be modified based on your comments or my own “clearer thinking and better information”.Read Full Post | Make a Comment ( 3 so far )