# Null Object Pattern

*noun*

say it: **“NUL OB-jekt PAT-urn”** **/nʌl ˈɑbdʒɛkt ˈpætərn/**

A design pattern that replaces a missing object with a stand-in that keeps the same promise and does nothing.

## What is the **Null Object pattern**?

The **Null Object pattern** replaces "nothing here" (`null`) with an object that keeps the same promise and safely does nothing. A room with no speaker gets a `NoSpeaker` whose `play` and `stop` do nothing, so every routine can call `room.speaker.play(...)` without first asking whether there is one. Skip it when something missing must be noticed, such as a lock.

## In a sentence

- “The bedroom's **null object** speaker meant no routine ever had to ask whether a room had one.”

Level: Journeyman · [More OOP terms at this level](https://www.ask-codey.com/glossary?category=oop&level=3)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/null-object-pattern
