> We are building a binary tree from nodes. There are ordinary nodes and "empty" nodes. Traversing the tree normally should not cause errors, so we use null object pattern where necessary.
> In object-oriented computer programming, a null object is an object with no referenced value or with defined neutral ("null") behavior. The null object design pattern describes the uses of such objects and their behavior (or lack thereof).
**Programmatic Example**
Here's the definitions for node interface and its implementations.
```java
public interface Node {
String getName();
int getTreeSize();
Node getLeft();
Node getRight();
void walk();
}
public class NodeImpl implements Node {
private static final Logger LOGGER = LoggerFactory.getLogger(NodeImpl.class);
private final String name;
private final Node left;
private final Node right;
/**
* Constructor.
*/
public NodeImpl(String name, Node left, Node right) {
* [Pattern Languages of Program Design 3](https://www.amazon.com/gp/product/0201310112/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0201310112&linkCode=as2&tag=javadesignpat-20&linkId=7372ffb8a4e39a3bb10f199b89aef921)
* [Refactoring to Patterns](https://www.amazon.com/gp/product/0321213351/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0321213351&linkCode=as2&tag=javadesignpat-20&linkId=2a76fcb387234bc71b1c61150b3cc3a7)