Domain-Driven Design (50 Qs)•Part 3: Advanced Architecture & Production Patterns (Senior / Lead)
How do you model Temporal / Time-Series data in DDD?
senior LevelSystem Design
In Simple Words: Time is an explicit first-class citizen in business domains:
- Never store just a mutable status without context.
- Use explicit Date Range Value Objects:
DateRange(start: Date, end: Date)with intersection and overlap methods (rangeA.overlaps(rangeB)). - Model domain events with explicit business timestamps (
occurredAt) rather than relying on technical database insertion timestamps.