blog.jj5.net (2003 to 2005)

NULL - The bane of my existence

Thu Oct 21 02:13:00 UTC+1100 2004

Categories:

NULL has a type, damn it!

At least it does in my view of the world.

To me NULL means: No statement can be made about the VALUE of this TYPE.

You can't avoid knowing the type of value you're expecting from 1st normal form out.

SQL_VARIANT *is* a TYPE. The fact that it's non-atomic will cause you problems, but it is a type nonetheless.

In an imperative environment, operations on NULL values should throw exceptions. TVL is only useful for SET based operations.. it's a super bad idea for imperative code, IMO (from the POV of managing complexity).

Generally you have to allow for the possibility that *any data* can be NULL at *some point in time*.

Perhaps it would have been best if System.Object defined a Boolean IsNull { get; } property.. with semantics that applied to 'value types' and 'reference types' appropriately, and that basically threw “Null[Reference|Value]Exception” if any attempt to operate on a NULL value was made (beyond the .IsNull query).


Copyright © 2003-2005 John Elliot