using record types to build better domain models
src: using record types to build better domain models - 2022-11-12
Abstract
Rules of thumbs:
- objects from real world turn into objects in software
- actions from real world turn into operations in software
Not everything in the real world is an object. Enters DDD.
Entity vs value objects
values from real world turn into values in software
Object is:
- identity
- has a life cycle
- (mutable) state
Value is:
- no identity
- timeless
Example
Entity:
- Account
Value:
- Amount
- Currency