Best design pattern for "undo" feature

tenfour picture tenfour · Aug 10, 2010 · Viewed 38.6k times · Source

Possible Duplicate:
Design Pattern for Undo Engine

In general, how do you deal with supporting an "undo" feature in your application? I have worked on web apps and desktop apps alike, and I have never really felt comfortable with any "undo" system I've made.

Answer

jethro picture jethro · Aug 10, 2010

I believe it should be Command design pattern.

Here is article about multilevel Undo/Redo with Command pattern.

EDIT: Here is second about multilevel Undo/Redo with Memento pattern.

So probably it can be done with both.