3 ms·
Not everything has a sensible null object. It also means that forgetting to set a value will often silently give wrong results instead of immediately producing
by int_19h 3y ago
Not everything has a sensible null object.
It also means that forgetting to set a value will often silently give wrong results instead of immediately producing an error.
- specialist 3y agoApologies, I omitted part of my proposal: While most Null Objects would (probably) be code generated, you can provide your own as needed. Said another way: Most of my Null Object implementations have been boilerplate, and therefore could be code generated. But occasionally some are not.
- int_19h 3y agoWhat I mean is that semantically there's often no such thing as a null object for a given domain. So any artificial one that can be made is indistinguishable from null in practice (i.e. all operations on it will throw etc).