This article describes the Memento design pattern. This is a behavioral design pattern, a category of design pattern used by software engineers, when writing computer programs.
The Memento pattern is a design pattern, used in software engineering, to capture and externalize the internal state of an object, so that it can be saved, and restored to the same state at a later time. This pattern defines an "originator" (which needs to be saved and restored), a "caretaker" which controls when and why the originator save or loads itself, and the Memento itself, which saves information from the originator int the data storage object (file, database, cookie, etc) It is defined as a behavioral design pattern, because the program executes the object based on the state information placed upon it from the stored values.
Saving and restoring state is useful for returning to an operation or a view at a later stage, like undo and rollback functions.
Undo, restore and rollback functions depend on a complete set of data relating to the previous state being stored and read back in. Web page cookies are mementos, as they contain session information, used by the web page when you return. Some word processing applications like Microsoft Word periodically save the document in temporary storage, in case of an unexpected exit from the application. Microsoft Management Console uses a Memento to set the view to the specified memento's state.
↑ Return to Top
XAML guy edited Revision 2. Comment: tweak
XAML guy edited Revision 1. Comment: tidied sections
XAML guy edited Original. Comment: spell, tweak