Ask Question

Where might the Null Object pattern be useful?

+1
Answers (1)
  1. 29 October, 20:51
    0
    Answer: Null Object pattern be useful when the absence of an object can be encapsulated by other alternatives which does not have any have any effect.

    Explanation:

    public interface Rectangle {

    double area ();

    double surfaceare ();

    boolean isNull ();

    }

    In the code above we have a function for null object. So in the absence of an object we have encapsulated with a method of null which does not do anything. It simplifies the use of dependencies that can be undefined.

    In case of collaborator the NULL object pattern makes use of the existing collaboration instead of defining a new one.

    It also enable to abstract the handling of null objects from the client so that internal details of the program are not know to outsiders.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Where might the Null Object pattern be useful? ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers