4

I've seen here that it was a dividing topic to use "should" as a prefix for a boolean because it could mean that we're unsure.

Then how would you prefix a boolean such as "myButton.shouldShow"?

I feel indeed that it's a little bit weird so I was hoping to find another solution.

lapin
  • 149
  • 1
  • 2

2 Answers2

7

I will use:

  • myButton.canBeShown if I want to know whether the button can be shown or not.
  • myButton.isShown or myButton.isVisible to know whether the button is currently showing or not.
  • myButton.isAlwaysShown to know whether the button must be shown everytime or not.
Hieu Le
  • 673
3

you are using a verb to describe state (show) which I think is where the problem arises. if possible I'd change it to isVisible or similar

jk.
  • 10,306