Parse, don't validate. A classic that I keep coming back to. The core idea is very simple: instead of validating data and throwing away what you learned, parse it into a more precise type that preserves that knowledge. The rest of your code gets simpler because impossible states become unrepresentable.
Using this pattern well will remove a lot of „if" statements and error handling scattered around the codebase.
Recent articles
- Hyphens and Dashes - 16th March 2026
- Context Windows Are Limited by Atoms, Not Bits - 1st March 2026
- My Own Little Corner of the Internet - 22nd February 2026