So let's say you have a function that returns a date
Date myFunc(paramA, paramB){ //conditionally return a date?
}
So is it appropriate to return null from this function? This seems ugly because it forces clients to check for null.
The "null object" pattern is an implementation pattern that addresses this concern.
I'm not a huge fan of the null object pattern, but yes it makes sense to always return a list, even if is empty than to return a null....
However, say in Java, a null date would be one that is cleared and has the year 1970.
So what does everyone think is the best implementation pattern here?