Design Pattern for Undo Engine

Most examples I’ve seen use a variant of the Command-Pattern for this. Every user-action that’s undoable gets its own command instance with all the information to execute the action and roll it back. You can then maintain a list of all the commands that have been executed and you can roll them back one by one.

Leave a Comment