Knowledge
Search knowledge... ⌘K
Knowledge · Anti-Patterns
Smell Primitive Obsession
Anti-pattern indicating need for refactoring
Tags
refactoring-fowlercode-smellmaintainability
Impact
Using primitive types for things that deserve small objects, such as money classes that combine number and currency, ranges with upper and lower bounds, and special strings such as telephone numbers and ZIP codes.
Symptoms
- Using primitives for domain concepts (money, phone numbers, etc.)
- Type codes or enums that affect behavior
- Groups of primitives that should be an object
- Arrays used as objects
Source
Martin Fowler — Refactoring: Improving the Design of Existing Code, 1st Edition (1999)