Command pattern
Also called: Undo stack
An action turned into an object that can be run later, undone, queued, logged or replayed.
Definition
A command holds everything needed to perform one action, and often to reverse it. Undo and redo stacks store executed commands; offline queues store commands as data and send them when the network returns. Persisted commands are delivered at least once, so each carries an id the server uses to ignore duplicates.
In practice
MoveShape(shapeId, dx, dy) moves a shape in execute() and moves it back in undo().