DEV Community

Discussion on: Does null safety (really) bring any value to businesses?

Collapse
 
jmfayard profile image
Jean-Michel 🕵🏻‍♂️ Fayard

Tony Hoare not only called it a mistake, but also brillantly explained why

I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.

As you can see null itself isn't a problem, the issue is that it was not integrated in the type system to ensure that all references are absolutely safe, with checking performed automatically by the compiler.

Adding null-safety to the type system is just a logical extension of the original vision.
If you like the idea of having a static type system that does automatically lots of checks, then you have no reason to not also want null-safety integrated in the type system.
If you prefer using no static type system and use Javascript, then OK.

I wrote about Tony Hoare here: dev.to/jmfayard/android-s-billion-...

Collapse
 
schwusch profile image
Jonathan Böcker • Edited

Great article there, and I wholeheartedly agree!
What I fail to understand is the industry attitude towards this integration of null into the type system. It seems to be apathy at large, which begs the question I asked in the article: Does it add anything to businesses? Not that I can answer the question myself, I just have to consider the fact that null-unaware type systems is not being abandoned in a significant hurry.

Collapse
 
jmfayard profile image
Jean-Michel 🕵🏻‍♂️ Fayard • Edited

Kotlin, Swift, typescript, GraphQL, F#, Eiffel have it, even Java via the @Nullable annotations. Not a bad start!