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 convention rules just as seriously as any other grammatical 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.
In theory it does not matter if you say public static final or final static public, but if you follow the usual convention, other people will able to read your code more easily. The Java language specification makes recommendations about the order of modifiers. It strongly encourages the following order:
CodeCompanion checks your code for conformity to 26 coding convention rules.
| [画像:book cover] | recommend book⇒The Elements of Java Styleto book home | |||
| by | Al Vermeulen [Editor], Scott W. Ambler, Greg Bumgardner, Eldon Metz, Alan Vermeulen, Trevor Misfeldt, Jim Shur, Patrick Thompson | 978-0-521-77768-1 | paperback | |
|---|---|---|---|---|
| publisher | Cambridge University | B000SEPERW | kindle | |
| published | 2000-01 | |||
| Covers coding conventions and how to write maintainable code. excerpt. | ||||
| Online bookstores carrying The Elements of Java Style
Australian flag
abe books anz
abe books.ca
Canadian flag
German flag
abe books.de
amazon.ca
Canadian flag
German flag
amazon.de
Chapters Indigo
Canadian flag
Spanish flag
amazon.es
Chapters Indigo eBooks
Canadian flag
Spanish flag
iberlibro.com
abe books.com
American flag
French flag
abe books.fr
amazon.com
American flag
French flag
amazon.fr
Barnes & Noble
American flag
Italian flag
abe books.it
Nook at Barnes & Noble
American flag
India flag
junglee.com
Google play
American flag
UK flag
abe books.co.uk
O’Reilly Safari
American flag
UK flag
amazon.co.uk
Powells
American flag
UN flag
other stores
| ||||
| Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder. | ||||
This page is posted
on the web at:
Optional Replicator mirror
of mindprod.com
on local hard disk J: