Summary
The Memento pattern lets you capture an object’s state so you can restore the object later. The means of storage may depend on whether you need to be able to restore an object after a few clicks and keystrokes or after days or years. The most common reason for saving and restoring objects during an application session is the support of undo operations. In such a case, you can store an object’s state in another object. To let an object persist across sessions, you can save the memento through object serialization or other means.