I don't think I would ever select this form of formatting myself, but if
it's a format that enough people want I don't see why it can't be supported.
At 11:52 PM 15/11/2001, you wrote:
>-1
>
>Hi Alan,
>
>I prefere to handle my common cases in the if-part of an if-else statement
>and
>the rare cases in the else-part. So, the statement:
>
>if (commonCondition) {
> action();
>} else {
> rareAction();
>}
>
>should be formatted according your suggestion the following way, doesn't it?
>
> if (commonCondition) {
>action();
> } else {
> rareAction();
> }
>
>I think this makes the code even more hard to read ...
>
>-Bj�rn
>
>
>--- Alain Ravet <[EMAIL PROTECTED]> wrote:
> >
> > Indentation levels should always correspond to the logical flow :
> > if (rareCondition)
> > rareAction();
> > action();
> >
> > You would never write it this way :
> > if (rareCondition)
> > rareAction();
> > action();
> >
> > But this is what we do with try-catch clause.
> >
> >
> > I found an alternative indentation (see below) in one of the java
> magazines.
> > It's so simple it's beautiful. So obvious. So effective.
> > After using for a week, I can't imagine writing a single try-catch
> clause the
> > old way.
> >
> >
> >
> > Before (the standard way)
> > ------
> >
> > try {
> > doStep1ThatCouldFail () ;
> > doStep2() ;
> >
> > } catch (SomeException e){
> > doThisOnlyIfSomethingFailed() ;
> >
> > } finally {
> > allwaysDoThis ();
> > }
> >
> >
> >
> >
> > After (the reverse indentation way)
> > -----
> >
> > try {
> > doStep1ThatCouldFail () ; // line *1
> > doStep2() ;
> >
> > } catch (SomeException e){
> > doThisOnlyIfSomethingFailed() ;
> >
> > } finally {
> > allwaysDoThis ();
> > }
> >
> >
> >
> > Move back 30cm, and look at both pieces of code.
> > Which one makes the more sense to you?
> >
> >
> > Problem :
> > 1� typing [return] at the end of line*1 will not put the cursor at the
> > expected level.
> > 2� IDEA source format does not support this alternative indentation.
> >
> >
> > Alain Ravet
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Find the one for you at Yahoo! Personals
> > http://personals.yahoo.com
> >
> > _______________________________________________
> > Eap-features mailing list
> > [EMAIL PROTECTED]
> > http://www.intellij.com/mailman/listinfo/eap-features
>
>
>__________________________________________________
>Do You Yahoo!?
>Find the one for you at Yahoo! Personals
>http://personals.yahoo.com
>
>_______________________________________________
>Eap-features mailing list
>[EMAIL PROTECTED]
>http://www.intellij.com/mailman/listinfo/eap-features
--
Stock Software Pty Ltd
_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features