11
Primitive Obsession
Symptom
Domain concepts represented as raw strings, numbers, or booleans — phone number is a string, money is a number, status is a code.
Goal
Each domain concept has a small typed home — Money, PhoneNumber, OrderId, Status — that knows its rules.
Smellier version
function priceFor(cents, currency) {
// ...
}Fresher versionclass Money { /* amount + currency, with arithmetic */ }
function priceFor(money) {
// ...
}Savings
Misuse becomes a type error; behavior accretes around the concept; refactoring is local to the wrapper.
Note
Validation and formatting scatter across every consumer; the type system can't catch wrong primitives in the wrong slot.