Applying de Morgan's rule doesn't change the evaluation order or the
behaviour of shortcut operators. It simply makes things easier to understand
sometimes.

I do agree that a boolean expression complex enough to make a automatic
re-arrangement worth it probably could use some extraction of named pieces.

-- Mark

-----Original Message-----
From: Nemec, Richard [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 14, 2001 04:22p
To: '[EMAIL PROTECTED]'
Subject: RE: [Eap-features] Code Style - parenthesize boolean
expressions


-xx

I simply don't like the whole thing. 
However, it's your preference to ask for it.
Just be sure you know what you're doing. Boolean operators in Java
are NOT the same thing as logical operators.
If you reorder, the operational result may be different.
function calls may have side effects (or performance impacts),
exceptions may be thrown or not (even without functions in
the expression), etc.

Another issue is whether a boolean expression complex enough
so that you need automated tool to re-arrange it - whether the
coding style can get some improvement.

r.

> -----Original Message-----
> From: Vollmer, Thomas - CannonSA [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 14, 2001 4:33 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [Eap-features] Code Style - parenthesize boolean
> expressions
> 
> 
> Sounds reasonable. The tree-view of a boolean
> expression might be a bit too elaborate in my
> opinion. If an expression is so complex that
> you need a tree-view to understand it, I would
> recommend to repeatedly apply the "Introduce
> Variable" refactoring to break it down.
> 
> -Thomas
> 
> > -----Original Message-----
> > From: Thomas Singer [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, December 14, 2001 11:23 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [Eap-features] Code Style - parenthesize boolean
> > expressions
> > 
> > 
> > At 12:46 14.12.2001 -0500, you wrote:
> > >I agree with Erb. Nontheless, "expression refactorings" would
> > >be nice to be able to refactor expressions so they show the
> > >intent or meaning most clearly (which of course, only the
> > >progammer can decide).
> > 
> > Agree.
> > 
> > >Along these lines, it would be nice if one could select
> > >a piece of a boolean expression and apply "de Morgan"
> > >style refactorings:
> > >
> > >!a && !b -> !(a || b) -> !a && !b
> > 
> > I meant this. Perhaps an extra dialog showing the 
> > tree-character of boolean 
> > expressions (with the ability to refactor them) would be cool.
> > 
> >         [&&]
> >      [!]    [!]
> >      (a)    (b)
> > 
> > or
> > 
> >         [||]
> >      (a)    (b)
> > 
> > 
> > >Don't know how useful this would be in practice,
> > >but it sure sounds worth exploring...
> > 
> > I believe, they would be *very* helpful, because a lot of 
> > complex boolean 
> > expressions cause a lot of bugs. Transforming them to better 
> > readable form 
> > lets you easier find bugs.
> > 
> > Tom
> > 
> > 
> > _______________________________________________
> > Eap-features mailing list
> > [EMAIL PROTECTED]
> > http://www.intellij.com/mailman/listinfo/eap-features
> > 
> 
> 
> ************************************
> If this email is not intended for you, or you are not responsible for
> the delivery of this message to the addressee, please note that this
> message may contain ITT Privileged/Proprietary Information.  In such
> a case, you may not copy or deliver this message to anyone.  
> You should
> destroy this message and kindly notify the sender by reply email.
> Information contained in this message that does not relate to the
> business of ITT is neither endorsed by nor attributable to ITT.
> ************************************
> 
> 
> 
> _______________________________________________
> Eap-features mailing list
> [EMAIL PROTECTED]
> http://www.intellij.com/mailman/listinfo/eap-features
> 

_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features

_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features

Reply via email to