The Eric Normand Podcast

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.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
ANECDOTE

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.
ADVICE

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.
ADVICE

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.
Get the Snipd Podcast app to discover more snips from this episode
Get the app