Java Coding Standards

11 PM May 16, 2004

Some coding standards from around the web:

Spotted in the introduction to the The Caltech Infospheres Java Coding Standards:

Code standards aren’t just about obsession…

Although, for some of those standards documents, obsession seems to play a large part.


1 Emphasis mine.

By alang | # | Comments (7)
(Posted to javablogs and Java)

Comments

At 07:27, 17 May 2004 Mats Henricson wrote:

I do NOT recommend the Ambysoft book. I have written about it here:

http://www.jroller.com/comments/matsh/Weblog/why_elements_of_java_style

(#)
At 14:15, 17 May 2004 Gwyn Evans wrote:

I DO recommend the Ambysoft book. Reading Mats's comments suggests that he's only skimmed the summary notes and hasn't actually bothered to read the book itself.

(#)
At 16:47, 17 May 2004 Pete McKinstry wrote:

I also strongly recommend the Amysoft book. I thought it was a great starting point for a development team choosing a coding standard.

(#)
At 17:10, 17 May 2004 Terry Bone wrote:

The Ambysoft book is perfectly fine. For one thing - it's reasonably priced and it is small enough to sit on everyone's desk for a quick reference. No one wants coding standards that you have to read 300 pages to understand. We created a small addendum and included it inside the cover and call it our standards doc.

(#)
At 09:27, 18 May 2004 Richard Atkins wrote:

I've found that http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/ are also quite helpful for pinning down what we developers should do when we get to the uglier bits (that's all of it, right? ;-) ) of JSP coding, and structuring java-based webapps in general.

(#)
At 09:58, 18 May 2004 Mats Henricson wrote:

Let me elaborate as to why I think the Ambysoft is bad. Take this example:

   Indent nested code.

Now, try to find anyone that would argue against this? What I mean is that they have spent time finding rules that aren't important, thus dragging down the usefulness of the whole book.

Another thing is that they haven't differed between rules and recommendations. Rules are almost never broken, recommendations are good ideas most of the time.

Another example:

   Use lazy initialization.

This is plainly wrong! Sometimes eager initialization is much much better, so what the hell do they mean?

Another:

   Maximize abstraction to maximize stability.

What the heck? Maximize even if the schedule is at risk?

What I really mean is that these guys are smart, but they have been very sloppy when they formulized the rules. A user would have to read the book to figure out what they really mean, which is much more than you can ask from an ordinary coder.

As a counter example, have a look at the C++ coding standard I wrote with a friend:

http://mongers.org/industrial-c++/

We even summarize the rules and recs into one page:

http://mongers.org/industrial-c++/IndustrialStrength-Summary.html

Sure, we also have meaningless recs like "Use meaningful names", but our rules and recs are much more carefulle written, so that they can be read much more on their own, without explanations.

(#)
At 11:04, 18 May 2004 Alan Green wrote:

Richard,

Would you believe I once worked with one of the authors of that standard? Thanks for reminding me. I'm sure Kam will give me a hard time when I see him next.

(#)

Add Comment




(Not displayed)






(Leave blank line between paragraphs. URLs converted to links. HTML stripped. Indented source code will be formatted with <pre> tags.)




© 2003-2006 Alan Green