ID as a Form of Primitive Obsession
kwstannard.github.io·2h·
Discuss: Hacker News
💸Affordable LLMs
Preview
Report Post

Primitive obsession: the act of utilizing language primitives like strings, integers, arrays, and such to represent complex domain objects. A common example of this is representing money with ints or floats. Primitive obsession tends to result in the spread of logic that could be cohesively contained in one file across the application, repetition of conversion logic through flows, and many strange hacks that slow comprehension.

A common issue I find across many organizations that is quietly hindering them is the utilization of identifiers inside of domain logic. Somewhat recently it hit me that this is a form of primitive obsession. Identifiers are strings or integers and they represent much larger domain objects, which qualifies them as a form of primitive obsession. Code that util…

Similar Posts

Loading similar posts...