Hacker News new | ask | show | jobs
by mrkeen 1280 days ago
> Boolean values are inherently a sign of an insufficient data model. Booleans carry no inherent meaning.

Would you say the same about Ints or Strings?

2 comments

Practical language-agnostic example: a database for a business where some VARCHAR(34) columns are IBAN codes and others are messages to be displayed on a 2 by 17 characters LCD screen.

They are two completely different data types that happen to have identical approximate representations but should be distinguished very strictly in a sufficiently expressive model.

For instance, it should be possible to turn an IBAN into a device screen message but not the opposite, but you can't do it if they are all "strings"; and the two types have different value constraints while a generic VARCHAR has none.

> They are two completely different data types that happen to have identical approximate representations but should be distinguished very strictly in a sufficiently expressive model.

About bools: that's my problem with this. If-statements now operate on anything, instead of just bools. And I don't think that makes sense, unless cheese.

About strings: It's great you can statically differentiate between their types. But if strings don't exist, it makes it a little hard to write WHERE clauses.

They're saying you should be able to define your own

The domain of int/str is infinite so there's less sense in redefining a number system for every property you want to model

For small finite domains it makes sense to define your own in terms of the problem domain

In this sense all two-valued types are bools