Stop Naming Your Variables "Flag": The Art of Boolean Prefixes (2025)
mooreds
12 points
4 comments
June 19, 2026
Related Discussions
Found 5 related stories in 115.2ms across 10,996 title embeddings via pgvector HNSW
- Forget Flags and Scripts: Just Rename the File Uptrenda · 12 pts · March 18, 2026 · 57% similar
- A case against Boolean logic boris_m · 66 pts · May 22, 2026 · 56% similar
- I keep tripping over "true, false, true" AllThingsSmitty · 23 pts · May 11, 2026 · 48% similar
- Go Naming Conventions: A Practical Guide begoon · 20 pts · March 27, 2026 · 48% similar
- Unsigned sizes: A five year mistake lerno · 77 pts · May 02, 2026 · 42% similar
Discussion Highlights (4 comments)
JSR_FDED
It goes beyond just naming Booleans, all naming of variables is hard
JSR_FDED
You start with a Boolean to represent two possible values/states. Then your program evolves and you need represent a third state, so what do you do? Obviously you add an other Boolean. I keep doing that and then for several weeks I deal with the extra pain and complexity this causes. Then always, and I mean always, I end up rewriting all that code using enums.
jessyco
This is something I've gone through and started to think about and eventually try and help others with. Working with mulitlingual people I noticed a tendency to use negative words "disabled" instead of "enabled" which always made code have !disabled everywhere. Tried the enum approach as well; Love focused writings like this to distill a lot of information into an easy to read form. the new concept for me is the `with` as in to apply functionality by extending a `with` class (this is inside an angular project). Also using types for values so when passing a value in for methods you don't get a blank true/false you get a human readable thing which is useful for debugging and building. Only care about optimizations later if it will ever matter.
krapp
This, but using bitfields and enums. Using multiple booleans like this seems like such a waste unless you're using a language that doesn't let you do otherwise.