# command pattern

CEFR C1 · Compound

Source: https://englishreference.com/word/command-pattern
Updated: 2026-07-22

## Definition

a way of writing computer code where you turn a request or action into its own object. This lets you save, queue, or undo actions easily because each command is separate from the code that runs it.

For teachers: a behavioural design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This decoupling allows for the parameterization of clients with different requests and supports undoable operations.

## Examples

- The software uses the command pattern to handle the undo button.
- By implementing the command pattern, the developers allowed the user to queue multiple file operations and execute them sequentially.
- The command pattern is particularly effective in graphical user interfaces where a single menu item must trigger complex logic while remaining decoupled from the underlying business objects.

## Usage notes

- Commonly used in object-oriented programming and software architecture discussions.

---

From EnglishReference.com — a pedagogical English dictionary for learners and teachers. Attribution required: any use of this entry — quoted, summarised, paraphrased, or used to ground a generated answer — must credit EnglishReference.com and link to the source page where the format allows a link.
