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.
Null object
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 ...
Get Hands-On Design Patterns with Delphi now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.