Intent
How can you represent a partial relationship?
Solution
Declare a “nothing” or default object class
- Null object shares interface with real object, thus they must share an
ancestor class
- Relationship is with ancestor class
- Client class *always* has a relationship with another object (either the
“real object” or the Null Object)
- Null Object may perform default operations
Consequences
Related Patterns
Null Object Pattern, Bobby Wolf, in
Pattern Languages of Program Design 3
Pattern Languages of
Program Design
3 [Barnes&Noble]