DEV Community

Discussion on: Tips on naming boolean variables - Cleaner Code

Collapse
 
dvddpl profile image
Davide de Paolis • Edited

absoulutely agree. i understand the need for the convention, since ( expecially at the beginning of your career) you are able to immediatly find or recogninze a boolean variable by the fact that starts with is or has, but was never bought into this.
exactly for the reason you mentioned,

is it a question? are you asking me? i don't know, you should tell me!

and because of the many exceptions that make some variables seriously grammatically terrible. I found this post because I was looking for alternatives or way of telling in a Pullrequest that isUserAlreadyExist is a complete NOPE for me...

imho, dimply use conventions when it makes sense, ( possiblly in thex affermative format - like useIsActive - which in my case would become a more natural userAlreadyExists)

Collapse
 
qodunpob profile image
Konstantin • Edited

What about the point that no code ask you but you have asked the data about something and store answer in variable with the same name?