In the tables I define everything is not null with sane defaults by default.
The places I do allow null are few and far between (e.g. updated_at) and I'm struggling to think of instances I've used them as anything other than absence indicators.
In fact I don't think I ever treat it as anything other than that in code either.
Was the purpose of null ever to mean anything other than I have not been defined/set?
All my objects are statically typed so I never run into the issue of testing is thing.x a thing, it's always a thing, or it's a compile error. It's either set or not set, and thanks to the database convention I only have to worry about certain values having null, most of the time it makes sense anyway. Is updated_at turthy doubles as has been updated tests.
Am I incorrect in this method? With this method I fail to see big extra complication. Will switching to option types help me? I debate they will not. But I'm happy to be convinced. I do avoid nulls. I just haven't seen a problem with them in my own code. (Not true for others)
Specifically, with the caching problem, provided you constrain the cache to reason about null == not set. I see no problem.
Cache.get(K) // null
Cache.set(K,3) // void
Cache.get(K) // 3
Cache.set(K, null) // deletes, void
Cache.get(K) // null
Cache.set(K, false)
Cache.get(K) // false
Only certain values of mine are going to potentially be null from the database, all of which will be contained within serialised objects.
I just never see the issue the author has. The times K do see it are when people get too clever with default values.
I understand it, I just don't see it in practice. Certainly my not frequently enough to make language changes.
Title should just read "Stop abusing null" because the only time I've seen it be an issue is when people are dual encoding meaning.