Java coding standards

I've been coding in Java for some time now and I've found that it's very useful to have common coding standards amoung those that you work with. So I've listed some coding standards that I expect others to follow when writing Java code. I've found that it's rather useful to always write as if the code will be used in production, because eventually it will (wether you like it or not).

Coding standards are important because they can make the code easier to read and quickly figure out what's going on. An example of this is how variables are named. If a group all agrees that class variables are named one way and local variables are named another way, one can instantly tell if a line of code just effects state in the local scope or if it effects state in the class scope. These coding standards are also in place to help out with common coding errors, such as adding a line of code after an if statement without an explicit body causing the if statement to execute a whole difference piece of code.

Start with the "Draft Coding Standard" by Doug Lea, The idea of making all methods synchronized doesn't really make sense though, so skip that one.

General coding conventions:

Some of these are repeast of the document from Doug Lea (above), but these are ones I want to highlight.

References

Here are some other sources worth looking at:

.

Valid XHTML 1.0! Valid CSS!