Repaso
EspaƱol
Design & PracticesAdvancedDP-22

Which pattern makes undo/redo and job queues natural?

Options

  1. Command (Correct option)
  2. Singleton
  3. Iterator
  4. Bridge

Answer

Command

Why

The Command pattern turns an action into an object, e.g. AddTextCommand with execute() and undo().

Because actions are objects, you can store them in a history list (undo/redo), put them in a queue to run later, log them, or retry them.

Remember

Command = an action stored as an object.

Key terms

Practice this question in Repaso