'''Intent:''' Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later. '''See also:''' FacadePattern, FacadeMementoStrategy, DesignPatterns, SecureMemento http://en.wikipedia.org/wiki/Memento_pattern ---- Links: *http://home.earthlink.net/~huston2/dp/memento.html *http://wiki.cs.uiuc.edu/patternStories/MementoPattern ---- 'This smells a lot like serialization. What difference is there, if any?' -- NathanielEliot Serialization is (AFAIK) done where the source object is stored and resurrected by ''another'' object and happens between different invocations of an application or between different applications. Here, the source object is still there and all that happens is state change. --RaptorBalaji ---- 'The memento pattern seems to be more flexible. You ask an object for its current state, and it can track whatever changes are made using special semantics, rather than dumping the entire state and rereading later.' -- PeterSchofield So, to restore an object you have to continue to change the object using some algorithms, but then you cannot ensure that the state you get is exactly the previous one - due to hysteresis (it's a known problem of semantics-preserving undo/redo mechanism). Memento pattern is the pattern that solves this problem exactly by "dumping the entire state and rereading later". -- MarkPresniakov ---- CategoryPattern | CategoryBehavioralPatterns