How far should you go with null safety?
In my own personal projects, I've been as strict as I could. Everything's required unless it has to be optional:
- Database fields get non-null constraints by default
- OpenAPI specs use the
required
keyword - Servers get defensive checks (or they use a language like Kotlin that doesn't allow nulls unless explicitly marked as optional)
- Clients use strict null checks (mainly TypeScript's compilation options, for me)
I'm wondering if that's going too far, because I've gotten pushback in prior jobs about my strict approach to null safety. Do other devs find there to be a point of diminishing returns?