CMSC 498B: Developing User Interfaces - Spring 2005

Undo/Redo and Command Design Pattern

Undo / Redo

Motivate class of problems that require undo / redo (most UI operations)

Brainstorm about how to solve generically

Introduce Command design pattern

Draw picture of Undo and Redo stack

Walk through Undo Example code

Discuss granularity (selection, dragging, individual character entry)

Discuss irreversible commands (save, load, mail). Do they have to be irreversible?

More complex situations

  • Change context and then Redo
  • Selective Undo
  • Groupware conflicts

Some limited support for Undo built into some controls (i.e., TextBox)

UndoExample.zip