DEV Community

Discussion on: Tips on naming boolean variables - Cleaner Code

Collapse
 
rob2d profile image
Robert Concepcion III • Edited

I mostly agree with you that code readability should be one of the #1 priorities, but at the tend of the day it depends on the context -- also the whole "when in rome" thing.

I'll give you just another perspective: in my situation, I don't use Typescript at my every-day-work, so things are weakly typed, and the IDE auto-prediction works relatively well with VSCode.

Because of that, using is/has/should gives several benefits (magnified in a weakly typed language):
-> auto-prediction is actually very helpful when there's no ESDoc annotation written in common code.
-> consistency, and knowing immediately what something is (though I'd agree and enjoy to work on more other-people's code which is thought out to read-well and flow well as you seem to encourage). There's an aspect of things where if you learn to speed read, the effect when you're glancing over words implies that you catch the first-and-last-part-of-words.
-> when interfacing APIs/other things, getters/setters are easy to automate code with (at least for JS/Ruby), and it's easy to write linter rules on weakly typed languages.