For style, I prefer "the simplest"  refactoring that is unambiguous:

        a && (b || c) && d || e && f -> (a && (b || c) && d)) || (e && f)

No parenthesys surrounding simple expresions please:) make it an option 
if it's necessary:

        (a == b && c != d) || !e        not: ((a == b) && (c != d)) || (!e)

OK to deMorgan refactorings: programmer refactorings are error prone:)

And a layout format with indenting supporting this would also be useful.

Carlos

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: sexta-feira, 14 de Dezembro de 2001 19:23
> To: [EMAIL PROTECTED]; [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

Reply via email to