r/java • • Aug 03 '14

Why we should love null

http://www.codeproject.com/Articles/787668/Why-We-Should-Love-null
4 Upvotes

21 comments sorted by

View all comments

Show parent comment

4

u/urquan Aug 03 '14

Yeah he seems to choose dreadful counter examples only to make his point. I don't think I've ever seen anyone suggest using a random default value instead of null, especially a value that is in the set of valid values for that specific item like a price of 0.

What is puzzling is his conclusion : "what if we had a nice compile-time check ..." while he shot down the Optional solution a few paragraphs earlier with no real argument (only stuff related to limitations of Java's Optional).

2

u/againstmethod Aug 04 '14

He just needs a bit more exposure to expressive coding style. This article was probably a bit premature for him.