Null Object pattern
Proficient programmers who are adept in a variety of paradigms and
languages recognize Design Patterns
as missing language
features. A new revelation
dawned on me today – a Design Pattern could be devised to work around
a wily language feature as well! I came to this realization after
reading about the Null Object
pattern. An entire
section of the book Object-Oriented Reengineering
Patterns
is dedicated to this topic, underlining the fact that the more
patterns you have in your code, the less expressive and
ill-designed the language you are using. Sometime back I wrote an
article on why NULL should
be removed from languages. If I had known about the Null Object
pattern then I would’ve saved some time by not writing this article,
as the existence of this pattern itself is a more convincing argument against the
case of NULL.