(2003 to 2005)

Null Object Pattern

Mon Jul 19 19:27:00 UTC+1000 2004


It's true, the null object pattern is awesome, it really is a shame it didn't make it into Design Patterns.

Null references are bad.

On a related topic, I haven't had a close look at C# v2 yet, but I think they have support for TVL. I think that's a bad idea, I think imperative code should not have logic necessary for set operations. But, what would I know.. :P

I wrote my own nullable type library, and it is little more than a uniform interface for querying for null and retrieving a value. You never operate on a nullable type, you operate on it's value, and it is an error to try and read the value of a null value, so you have to query IsNull first or you are implicitly asserting that the value is not null.


Copyright © 2003-2005 John Elliot