Java Glossary : Coding Conventions

CMP home Java glossary home Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You are here : home : Java Glossary : C words : Coding Conventions.

Coding Conventions
Sun has dared to go were mortals fear to tread and has laid down a set of coding conventions -- how to lay out your code, where to break lines etc. I know of no tool to take messy code and tidy it up, making it conform to the Sun conventions. You can, however, beautify it, which does only a part of the job. Naming conventions are discussed in greater length in the online Java Language Specification. Doug Lea, author of the book Concurrent Programming in Java also has a draft coding standard. Marc W.F. Meurrens maintains a list of coding convention proposals.

Capitalisation

The basic rules are: These rules are particularly important when posting snippets on the Internet. If you violate them, your code will be extremely confusing.

Keyword Order

The Java language specification makes recommendations about the order of modifiers. It strongly encourages the following order:

Smalltalk Inspired Conventions

I did contract work for a company called Immuexa. Immuexa follows Sun's coding and naming conventions. In addition Immuexa has the following rules: You can have rwars about beautifier settings on how { } should align. It does not matter much as long as you are consistent on a project and always beautify before committing to the code repository. Without coding conventions that can be semi-automated with a beautifier, you will get all kinds of false deltas in the repository. This can make it impossible to track who changed what, when.

CodeCompanion checks your code for conformity to 26 coding convention rules.

book_coverThe Elements Of Java Style
0-521-77768-2
Al Vermeulen (Editor), Scott W. Ambler, Greg Bumgardner, Eldon Metz, Alan Vermeulen, Trevor Misfeldt, Jim Shur, Patrick Thompson
Covers coding conventions and how to write maintainable code. excerpt.
amazon.com Barnes and Noble
amazon.ca chapters
amazon.co.uk amazon.de


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 2048.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/codingconventions.html J:\mindprod\jgloss\codingconventions.html