Skip Navigation
I know that naming variables is one of the biggest unsolved problems of Computer Science but how would you name a boolean flag to be self explanatory?
  • I think I see what you mean, you have two states and kind of opposite but you usually name the variable after one of them, so you have to "guess" the other one. For instance you could have isRightHand, the opposite state being left hand, but from the variable name you can't be sure if it could be "not right hand" as in right foot or something like that. Man it's kind of difficult to come up with examples.

  • I know that naming variables is one of the biggest unsolved problems of Computer Science but how would you name a boolean flag to be self explanatory?
  • Not sure I understand your second example, if is_person_standing is false I'd assume the person is not standing and that's all the information is needed. As you said it yourself, if more information is needed maybe a boolean is not the best choice, or a second variable could be used.

  • InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)RO
    Roberto @mujico.org
    Posts 0
    Comments 6