Hacker News new | ask | show | jobs
by ivan_gammel 1046 days ago
Null safety at application level is just a good architecture, test coverage and regular code reviews. It is not an internalized struggle of any sort. Last time I saw uncaught NPE in server logs was a long time ago: why would it necessarily be more frequent than some data validation error?
1 comments

> Null safety at application level is just a good architecture, test coverage and regular code reviews.

Anything relying on that is brittle. I work on a 20 years old code base with the majority of the base classes being 15+ years old. This is exactly where Java should shine, and it's not doing bad, but it's very hard to enforce top-notch coding standards across ~200 devs committing during that time frame.

As a result, there isn't much of an information on the nullability of return types, and you end up defensively handling nulls everywhere which is just noise.

> Last time I saw uncaught NPE in server logs was a long time ago

Luckily these are rare also for us, I guess most are caught during development and then on some test environment / CI, but catching these anytime later than compilation is way too late. The cost of a bug is directly connected with time between introduction and fixing it.