Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/22/01 19:58
Read: times


 
#14343 - RE: use of flag, Phillip
A proviso; some labels similar to "door_flag" make great sense if they evaluate sensibly as "TRUE or FALSE"

But that was my point entirely - "door_flag" can never make great sense as a True/False value:
What sense does "door_flag=True" have?
What does it mean:
1 This is a door;
2 This door is open;
3 This door is unlocked;
or what!?

Instead, the meaning should be precisely clear from the name:
1 is_a_door - True obviously indicates that it is a door;
2 door_is_open - True obviously indicates that it is open;
3 door_is_unlocked - True obviously indicates that it is unlocked;
etc, etc, etc

Example 3 also shows another point which needs careful consideration - positive or negative logic:
would door_is_locked be better?

Generally, positive logic is preferable:
!door_is_locked (ie, it's unlocked) is usually easier to interpret than !door_is_unlocked (ie, it's locked - a double negative!)



List of 17 messages in thread
TopicAuthorDate
use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag            01/01/70 00:00      
RE: use of flag, Babar            01/01/70 00:00      
RE: use of flag, Babar            01/01/70 00:00      
RE: use of flag, Phillip            01/01/70 00:00      
RE: use of flag, Phillip            01/01/70 00:00      
RE: use of flag, Phillip            01/01/70 00:00      

Back to Subject List