0

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.

closed as primarily opinion-based by Greg Burghardt, Bart van Ingen Schenau, gnat, Robert Harvey May 2 at 14:55

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

2

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.
1

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

  • is is a verb too. – David Arno May 2 at 8:52
  • oh yes, hmmm, show still seams wrong though but now i'm not sure why – jk. May 2 at 9:01
  • I'm being a little unfair as "show" is just a verb, whereas "isVisible" is a verb and adjective. I know that a lot of folk like to use is and the like for booleans. I personally dislike them and would just go with the adjective, Visible. – David Arno May 2 at 9:22
  • I would go a step further and name it somethingIsVisible where something is replaced with the thing that is visible or not. – Adam B May 2 at 13:11
  • @AdamB usually that thing would be the object that isVisisble is a member of so that would be somewhat redundant – jk. May 2 at 18:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.