Behavioral Design Patterns-Null Object
Behavioral design patterns are all about object communication. The Null Object Pattern may be one of the simplest, yet all knowing Behavioral pattern. The Null object is pretty much a copy of an object in which the default behavior is replaced with “do nothing” behavior.
The Null object solves the problem when a class needs a collaborator, but does not require that collaborator to do anything. Rather than using a null reference which can throw exceptions, the class can use the null object which will do nothing.

The Implementation is quite simple, as explained in the diagram above . The client will require Collaborator which is our abstract object. First we create a real object which full implements the Abstract Object methods request. The Null Object will also implement the Abstract Object interface, but it’s request method will do nothing.
Take a look at the simple java example below.

1. First we have out abstract interface outlining the required object behavior. Our client, any class implementing the progress interface, will use this model behavior to communicate with the Null Object.

2. Our Null Object NullGameProgress implements the getSavedState outlined in our progress interface. Our method does literally nothing and doesn’t return any null types. Our client can now have its collaborator, who’s behavior does nothing,

3. When the Client needs that behavior to be fully executed they can speak to a non null object like GameProgress.
In review the Null Object pattern is ideal for when a client needs a collaborator. The pattern doesn’t initiate collaboration, but is implemented within preexisting relationships between objects. As a result this pattern allows for the abstraction of null away from the client when needed.