[This message has been edited by Marilyn deQueiroz (edited February 23, 2001).]
Johannes de Jong
tumbleweed
Bartender
Joined: Jan 27, 2001
Posts: 5089
posted
0
Why would (should) you avoid using the ! (not)
Peter Gragert
Ranch Hand
Joined: Jan 16, 2001
Posts: 421
posted
0
I used this construction in one of my solutions and was advised to not use !boolean. Peter
Joe Von
Ranch Hand
Joined: Feb 22, 2001
Posts: 32
posted
0
I believe that the motivation behind avoiding the negated boolean is simply readablity. It is simpler and more understandable to reverse the if / else statement. A future reader will have an easier time with an "if TRUE" than with an "if not TRUE" construction. Of course, the functionality is the same both ways, but you always want to assume that sometime in the future some drooling moron will need to understand and modify your code. And you should try and help the poor benighted sod.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Peter Gragert
Ranch Hand
Joined: Jan 16, 2001
Posts: 421
posted
0
Suggestion of my son: If the then part is very long and the else part is short it may be meaningful to use a negated boolean, because one can see this 'easy' agaist 'difficult' part with just opening your eyes. Comments?