Get the latest tech news

Don't use booleans (2019)


ums instead. With any blanket statements like this, there are always exceptions.

Though in general, I believe the use of enums is often a better choice compared to boolean, unless you really need to squeeze your data into one single physical bit. Recently, I came across a function call in our code-base where I challenged my team to name the arguments for some cash, and sadly, I kept my money. Whenever I was about to use booleans and stepped back to consider using enums as an alternative, I often found myself going over the actual use-cases, or the behaviors and states of the application.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Booleans

Booleans