That boolean should probably be something else

Original post: That boolean should probably be something else

Nicole Tietz’s recent post is a fantastic read on why we should be wary of using booleans in our data models.

Specifically:

They’re sneaky. They feel like they make sense for our data, but they make sense for our logic. The data is usually something different underneath. By storing a boolean as our data, we’re coupling that data tightly to our application logic.

For example, using and storing booleans causes us to lose precious information: is_confirmed doesn’t store when the confirmation happens, which might be helpful. Or to write not maintainable code, as we might end up in a net of inter-dependent booleans, which could be solved by using other data types.

I couldn’t agree more!