Domain modelling made simple: Functions and Values
summary
F# code models a train-booking domain in about 40 lines, using single-case unions to prevent mixing IDs and names, discriminated unions to encode mutually exclusive carriage kinds, and option/result/async types to represent missing data, failures and network effects. A confirmed-train wrapper prevents notifying unconfirmed trips at compile time. The VS Code REPL executes types and functions live so incremental changes reveal missing cases and compile errors immediately; the example compiles, runs, and exposes precise domain errors for business review.
AI-written summary · about
chapters (3)
related talks
49mDomain Modeling Made Functional
51mDomain Modeling Made Functional
52mDomain Modeling Made Functional
43mWrite your own domain specific language with F#
58mDomain Driven Design (DDD) with Algebraic Data Types (ADT)
46mFunctional programming in F# Fad or Fabulous
01h 00mFunctional-first programming with F#
51mFunctional Programming and Domain Driven Design - a match in Heaven!
