2014/1/23 Otto Behrens <[email protected]>: >> MyNullClass>>#ifNil: nilBlock ifNotNil: notNilBlock >> nilBlock value. >> >> Any ideas? > > I've got a slightly different understanding of the null object > pattern, perhaps.
Me too. A "null object" is an object that is polymorphic with some other. Eg. "Person" and "NullPerson". It is a good pattern to avoid testing for nil (#isNil, etc.) in domain objects, and also avoid MessageNotUnderstood exceptions during runtime (or NullPointerException). :) In one system we had NullNumber class (and singleton instance) to be polymorphic with Number for number attributes with three states (nil, 0, value). I don't know your particular use of MyNullClass, but looks like a NullUndefinedObject :) Regards! Esteban A. Maringolo
