xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <dev.jerem...@greenmail.ch>
Subject Re: FOP Style Guide (update)
Date Wed, 08 Jan 2003 13:32:32 GMT
I've got the same problem with that. I've found more than a few
occurences of that last example in FOP. It would be nice to restrict
that rule to one line ifs/fors/whiles. Having more than one line in
total should mean having to use braces. Unfortunately, checkstyle
doesn't support that. Maybe that's something for their wishlist.

Or if checkstyle could also check indentation...

Well, I agree that it's easier to read, but I want to be on the safe
side when it comes to semantic differences (you only have to add two
characters to really play safe). So, if checkstyle doesn't support the
above, I'd rather leave the settings as they are (even though I started
this in the first place).

On 08.01.2003 14:23:36 Peter B. West wrote:
> Christian Geisert wrote:
> > Peter B. West wrote:
> > 
> >> Jeremias Maerki wrote:
> >>
> >>> Since I've made the checkstyle.cfg file an integral part of our style
> >>> guide I have to bring this up before changing:
> >>>
> >>> I'd like to add a line "checkstyle.ignore.braces = yes". This enables
> >>> one line ifs like the following:
> > 
> > 
> > [..]
> > 
> >> if (isEnabled)
> >>     doOneLiner();
> >> else
> >>     return false;
> >>
> >> which is easier to read than
> >>
> >> if (isEnabled()) doOoneLiner();
> >> else return false;
> > 
> > 
> > And what about this:
> > 
> > if (isEnabled())
> >     doThis();
> >     doThat();
> > 
> > Yes, I like explicit braces.
> 
> For the above reason, which is the primary argument for them.  It's 
> usual expression would, I think, involve changes to the code, so that 
> what started as
> 
> if (isEnabled())
>      doOneLiner();
> else
>      doOtherOneLiner();
> 
> becomes
> 
> if (isEnabled())
>      doOneLiner();
> else
>      doOtherOneLiner();
>      oopsForgotThisOne();
> 
> which errors can be hard to find when the indentation confuses the 
> issue.  Nonetheless, I prefer the braceless style for one-liners, 
> because it is easier to read, IMO.  And it adds just a spice of danger.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Mime
View raw message