Type-Driven Design Layer 1: Language Mechanics Core Question How can the type system prevent invalid states? Before reaching for runtime checks: - Can the compiler catch this error? - Can invalid states be unrepresentable? - Can the type encode the invariant? --- Error → Design Question | Pattern | Don't Just Say | Ask Instead | |---------|----------------|-------------| | Primitive obsession | "It's just a string" | What does this value represent? | | Boolean flags | "Add an is valid flag" | Can states be types? | | Optional everywhere | "Check for None" | Is absence really possible? | | Val…