Overcoming Our Primitive Obsessions
summary
Shows how replacing primitive strings with richer types reduces bugs and duplicated rules: use a SKU value object to enforce length/currency, a Category enum that embeds color, and remove scattered Twig extensions/managers. Adds PHPStan architecture checks to catch wrong types so validation lives in one place; adding a new category becomes a small localized change instead of edits across many files.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:14Code smells origins
- 5:28Primitive obsession explained
- 10:18Concrete examples
- 13:49Fixing SKU bug
- 22:38Primitive obsession in frameworks
- 24:04Adding event category
- 31:05When to use primitives
- 32:52Overengineering vs simplicity
- 35:19Conclusion








