Command pattern

/kəˈmænd ˈpætərn/ noun

Definition

A design pattern that encapsulates requests as objects, allowing you to parameterize clients with different requests, queue operations, log requests, and support undo functionality. It decouples the object that invokes the operation from the one that performs it.

Etymology

Named after military command structures where orders are issued without the commander knowing implementation details, formalized in the Gang of Four book (1994). The pattern emerged from GUI development needs for undo/redo functionality and macro recording.

Kelly Says

The Command pattern is like writing sticky notes for tasks - instead of doing things immediately, you write down 'wash dishes' or 'walk dog' as command objects that can be executed later, stored in a queue, or even undone! This is exactly how your text editor's undo button works: each edit is a command object that can be reversed.

Related Words

Explore More Words

Get the Word Orb API

Complete word intelligence in one call. Free tier — 50 lookups/day.