domain-modeling - Concepts
Explore concepts tagged with "domain-modeling"
Total concepts: 5
Concepts
- Algebraic Data Types - Composite types built by combining other types in two ways: "and" (product types, like records) and "or" (sum types, like tagged unions), which lets you model a domain precisely.
- Primitive Obsession - A code smell where primitive types like strings, integers and booleans represent domain concepts that deserve their own small types.
- Smart Constructor - A function that is the only way to create a value of a given type and that checks the type's rules, so every value that exists is guaranteed to be valid.
- Make Illegal States Unrepresentable - Design your data types so that invalid combinations of values simply can't be created, and let the compiler catch a whole class of bugs for you.
- Newtype Pattern - A technique that wraps an existing type (often a primitive) in a new, distinct type, so the compiler can tell apart values that share a representation but mean different things.
← Back to all concepts