An Action You Can Hold

An Action You Can Hold: Command: An Action You Can Hold, Undo and Redo with Commands.

Updated

  1. Command: An Action You Can Hold (Journeyman): When the dispatcher's plan for the morning is stored as rows of text and run by a switch on each action's name, every new kind of action means editing the runner; the Command pattern turns "Assign package 42 to Dana" into an object that can be stored, queued, logged and run later.
  2. Undo and Redo with Commands (Journeyman): An undo button that remembers only the last change can't take back two mistakes, and can't redo anything; when each command knows how to reverse itself, a stack of done commands and a stack of undone ones give the dispatcher as many undos and redos as she needs.