Which pattern makes undo/redo and job queues natural?
Options
- Command (Correct option)
- Singleton
- Iterator
- 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.