NULL: The worst mistake of computer science? (2015)
To someone who has been using Asm and C for decades, these arguments just make no sense. Reading this article reminds me of the arguments against pointers, another thing that's frequently criticised by those who don't actually understand how computers work and try to "solve" problems by merely slathering everything in thicker and thicker layers of leaky abstraction. It's not far from "goto considered harmful" either.<p><i>any reference can be null, and calling a method on null produces a NullPointerException.</i><p>...which immediately tells you to go fix the code.<p><i>There are many times when it doesn’t make sense to have a null. Unfortunately, if the language permits anything to be null, well, anything can be null.</i><p>That's not an argument. See above.<p><i>3. NULL is a special-case</i><p>...because it indicates the absence of a value, which <i>is</i> a special case.<p><i>though it throws a NullPointerException when run.</i><p>...and the cause is obvious. I'm not even a regular Java user (and don't much like the language myself, but for other reasons) and I know the difference between the Boxed types and the regular ones.<p><i>NULL is difficult to debug</i><p>Seriously? A "nullpo crash" is one of the more trivial things to debug, because it's very distinctive and makes it easy to trace the value back (0 stands out; other addresses, not so much.) What's actually hard to debug? Extraneous null checks that silently cause failures elsewhere.<p>The proposed "solution" is straightforward, but if you reserve the special null value to indicate absence then you can make do with just <i>one</i> value instead of a pair, of which half the time half of the value is completely useless. If you can check for absence/null, you will have no problems using Maybe/Optional. If you can't, Maybe/Optional won't help you anyway --- because it's ultimately the same thing, using a value without checking for its absence.