Coding Conventions : Java Glossary

go to home page C words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish punctuation 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 (all) ©1996-2009 Roedy Green, Canadian Mind Products
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.

Some people will tell you that these conventions are “optional” They are optional in the same sense that clothes are optional for an inaugural ball. There is nothing to stop you from violating the conventions, but there will be consequences. If you fail to follow coding conventions, posters on the Internet will mercilessly berate you for writing deliberately opaque code and most employers will fire you. Treat the coding covention rules just as seriously as any other grammatic rules. Don’t let yourself get into sloppy habits while learning to code on you own. The conventions help you too, Don’t fight them.

Javac.exe will not give you any warning when you violate the coding conventions. You are completely on your own to ensure compliance.

The coding conventions are optional only in the sense that Javac does not consider its duty to enforce them, because there are some rare circumstances where you might need to violate them in machine-generated code. Doug Lea, author of the book Concurrent Programming in Java also has a draft coding standard.

Capitalisation

The basic rules are: These rules are particularly important when posting snippets on the Internet. If you violate them, your code will be confusing, and people will likely bark at you for you inconsideration. If you insist on being sloppy, you will be soon fired from a programming team.

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 . 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.

Learning More

Doug Lea, author of the book Concurrent Programming in Java also has a draft coding standard.
book cover recommend book⇒The Elements of Java Style
 paperback
ISBN13:978-0-521-77768-1impressioncounter
publisher:Cambridge University Press
published:2000-01
by: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.
UK flag abe books.co.uk abe books.ca Canadian flag
UK flag amazon.co.uk. amazon.ca. Canadian flag
German flag abe books.de chapters.indigo.ca. Canadian flag
German flag amazon.de. abe books.com American flag
French flag abe books.fr amazon.com. American flag
French flag amazon.fr. barnes and noble.com American flag
Italian flag abe books.it powells.com American flag
Spanish flag iberlibro.com sony e-books American flag
Australian flag abe books anz

CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/codingconventions.html J:\mindprod\jgloss\codingconventions.html
CMP logofeedback Please email your feedback for publication, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.191.105]
You are visitor number 26,498.