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.

Peter
--
Peter B. West [EMAIL PROTECTED] http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to