Hacker News new | ask | show | jobs
by radicalbyte 4807 days ago
In object-oriented modelling you often see the Null Object pattern being used to the same effect.

http://en.wikipedia.org/wiki/Null_Object_pattern

It needs static analysis tools such as Code Contracts (C#) or SpringContracts (Java) to make it really robust.

1 comments

The null object pattern and Maybe/Option are different concepts. The most important point: A NOP for some type T exposes T's API directly, while Maybe/Option has its own API (and the type system enforces that Option[T] can't be treated as a T).