What is Null Object pattern?

  • A design pattern in which a special object, called the null object, is used to represent the absence of a value, avoiding the need for explicit checks for null values
  • A design pattern in which an object, called the context, holds a reference to an instance of one of several possible concrete state objects, each of which represents a distinct state of the context and implements a common state interface
  • A design pattern in which an object, called the decorator, adds or overrides behavior of an existing object, dynamically
  • A design pattern in which an object, called the prototype, is used as a template to create new objects, without specifying their concrete classes
The Null Object pattern is a design pattern in which a special object, called the null object, is used to represent the absence of a value, avoiding the need for explicit checks for null values. The Null Object pattern is used to provide a default implementation of an interface, reducing the amount of error-prone null checks in the code. The Null Object pattern can also be used to simplify the code and reduce coupling by eliminating the need for explicit checks for null values.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *