📎 Webclip
Making Defects Impossible
The article says repeated defects are especially frustrating and argues for finding ways to make common errors impossible to hide. It recommends choosing techniques carefully, since some trade readability or other benefits for stronger guarantees.
Reading notes#
- Catch run-time errors at compile time when the language or tooling can detect bad calls and type mismatches early.
- Use immutability to ensure an object stays in a valid state once created, as with
DateTime. - Encode valid states in types with discriminated unions so validation becomes part of the type system.
- Treat null as an explicit case with options, so code must handle both present and absent values.
