Is Maybe an Option? How to Model Nothing
summary
Null causes ambiguous states, so the code replaces it with Option/Maybe for parseWetsuitSize and repository returns, and introduces a Result type for errors; concrete scuba-diving examples show a registration return type implemented as a sum type with cases Accepted(confirmationNumber), CourseFull and WaitingList. Examples use F# and C#-style patterns; the compiler forces handling of none/ok cases and algebraic data types make illegal states unrepresentable, preventing runtime null checks and reducing domain bugs.
AI-written summary · about
chapters (9)
- 0:00Introduction to modeling
- 1:36The problem with null
- 4:50Dealing with uncertainty
- 7:11Using the option type
- 11:02Error handling with results
- 13:51Limitations of options
- 17:23Algebraic data types
- 19:15Unrepresentable states
- 20:27Conclusion and takeaways
related talks
25mLeveraging (algebraic data) types to make your UI rock solid
32mCommunicating Intention with Functional TypeScript
49mDomain Modeling Made Functional
25mLeveraging (algebraic data) types to make your UI rock solid
09mInterview of Mark Rendle
01h 13mNull & Void – Everything About Nothing in .NET
25mMaking Impossible States Impossible
40mEnhanced safety with types
