Coding conventions

Many groups use a specific set of coding conventions as a programming style guide.

Oracle's coding conventions are popular, but be warned that Joshua Bloch (author of Effective Java) once stated that this document should not be taken too seriously, as it's not actually used at Oracle (formerly Sun Microsystems)!

Doug Lea, author of Concurrent Programming in Java, has also published a set of coding conventions, and many others are available on the web.

Coding conventions should be used as a guide, not as a sacred, immutable law of nature. Those with less experience will initially benefit from following conventions, but as you gain experience, you should rely more on your own sense of taste, as opposed to blindly following the rules. The problem with rules is that there are many cases in which they should be broken.

In general, the question in your mind should always be one of compassion for the reader: "Will this help or hinder a maintainer who is unfamiliar with my code?". That is the guiding principle.

See Also :
Naming conventions
Wisdom, not rules