

Applying domain modeling to an existing data structure
Apr 10, 2023
Learn how to apply domain modeling to existing data structures by writing validation and normalization operations. Explore concepts like handling invalid states and achieving standard forms of data representation. Discover an adapter function that interprets boolean values into string states for improved readability.
AI Snips
Chapters
Transcript
Episode notes
Boolean Example Shows Data State Issues
- Using three booleans to represent four document states creates eight possible invalid states.
- This complicates understanding if a document skipped a stage or the state is incorrect.
Validate Invalid Data States
- Use validation functions to detect invalid states in existing data models.
- Reject or flag invalid states to improve code robustness and centralize checking.
Normalize Data for Consistency
- Normalize equivalent data states to a canonical form to enable equality comparisons.
- For example, sort array elements alphabetically to represent the same pizza topping order.