It’s Never Just a Something
Primitive Obsession is not called “Primitive Preference” for a reason: we can find ourselves clinging to primitives like addicts, even when every aspect of our project nudges us, hints, and screams that we should be doing something different.
It’s never just “a string”.
It’s never just “an integer”.
It’s never just “true” or “false”.
We don’t model software with “just-a’s”. We model software with rich, meaningful concepts. If we don’t do it in code, we do it in our heads, and then we can get things wrong. A person’s name is backed by a string; an age is backed by an integer. It’s all 0’s and 1’s on the machine level, but that’s not what we manipulate.
We’re obsessed with primitives because they are there, and sometimes “What You See Is All There Is” (WYSIATI, popularized by Daniel Kahneman in the 2011 book “Thinking, Fast and Slow”).
They are there not just when we need them, but also when we don’t. Our thoughts are anchored to using them because they’re everywhere.
Meanwhile, a name, an age, or a type for money, isn’t readily available, and we humans are often lazy animals, so we fail to make it so and bring these concepts into existence.