The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Stylin'

Posted by Matt Gerrans on November 21, 2001 at 7:30 PM

Hey! I originally assumed you were referring to the somewhat flawed The Elements of Java Style book (which promotes bad brace placement and gives no good reason to support that position), but I see that this Java Programming Style Guide is from JavaRanch and is a much better and rational style guide than the book (which is a bit jack-booted in its style, as it doesn't even give rationales for its edicts).

- mfg


> > i was reading an article i printed out :p
> > check this out Java Programming Style Guide
>

> Of couse, keep in mind that they are only guidelines, not rules, and on some points they have made some dreadful mistakes in judgement; in particular, they encourage poor placement curly braces (based simply on historical precedent). They suggest this difficult-to-read and ugly style:
>


> class BadStyle {
> void method() {
> for( blah ) {
> while( blah ) {
> ...
> }
> }
> }
> }
>

> (a throwback to the C programming days, when cryptic code was valued, because people believed if others could not understand what they wrote, the must surely be more clever than those others) instead of this easy-to-grok and aesthetically pleasing style:
>

> class GoodStyle
> {
> void method()
> {
> for( blah )
> {
> while( blah )
> {
> ...
> }
> }
> }
> }
>

> ...not that I have any biases on the matter. This is just my completely objective assessment of the situation, of course. ;-)

> - mfg






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us