In object-oriented programming, code sometimes refers to an optional object. The absence of an object doesn't represent an error; it is just an obstacle to writing clean code. Sometimes, we can replace such a missing object (a nil value) with a null object. A null object implements the same interface as a real object, but replaces each method with a do nothing implementation.
Most modern operating systems know about the concept of a null device. For example, NUL on Windows and /dev/null on Unix and similar systems are devices that are empty if we read from them. They will also happily store any file you copy onto them, no matter what the size. You'll never be able to retrieve that file, though, as the null device will stay empty no matter what you do with it.
The null object pattern is a relatively recent addition to the object-oriented programmer's...