Skip to content

Commit 1cd0cb8

Browse files
committed
Added Null Object pattern description.
1 parent 1cad280 commit 1cd0cb8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* [Model-View-Presenter](#model-view-presenter)
3838
* [Double Checked Locking](#double-checked-locking)
3939
* [Servant](#servant)
40+
* [Null Object](#null-object)
4041

4142
## <a name="abstract-factory">Abstract Factory</a> [&#8593;](#list-of-design-patterns)
4243
**Intent:** Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
@@ -382,6 +383,14 @@
382383
**Applicability:** Use the Servant pattern when
383384
* When we want some objects to perform a common action and don't want to define this action as a method in every class.
384385

386+
## <a name="null-object">Null Object</a> [&#8593;](#list-of-design-patterns)
387+
**Intent:** Null Object is used instead of null values to simplify algorithm and avoid explicit null checking.
388+
389+
![alt text](https://github.com/iluwatar/java-design-patterns/blob/master/null-object/etc/test.png "Null Object")
390+
391+
**Applicability:** Use the Null Object pattern when
392+
* You want to avoid explicit null checks and keep algorithm elegant and easy to read.
393+
385394

386395
# Frequently asked questions
387396

0 commit comments

Comments
 (0)