Preventing Bugs with Better Types - An Intro to Type Driven Design
summary
Shows concrete TypeScript and C#-friendly patterns: replace loose strings with enums and a Measurement type so kilometers vs miles can't be swapped, model cards with sum types for rank/suit and a product type for Card, and use tagged unions so Deck and Hand are not interchangeable. Implements Blackjack scoring that returns soft/hard points and normalizes soft aces to hard when over 21; examples compile and produce correct totals.
AI-written summary · about
