Memento Pattern
Updated 2026-07-30
Summary
The memento pattern is a software design pattern in the field of object-oriented programming that allows reverting the state of an object. Uses of this design pattern include undo, version control, and serialization. The memento pattern is implemented with three objects: the originator, a caretaker …
Definition
Without violating encapsulation, capture an object's internal state and save it outside the object so that it can be restored later. That is, 'save/load'. Scaffold use: decision snapshot. Before making a major decision, write down your current feelings, the data you rely on, and the expected outcome (save). Review it half a year later (load), which is the best tool for calibrating intuition and avoiding hindsight bias.
Introduction
How to use
Decision snapshot. Before making a major decision, write down your current feelings, the data you rely on, and the expected outcome (save). Review it half a year later (load), which is the best tool for calibrating intuition and avoiding hindsight bias.
Mechanism
Without violating encapsulation, capture and externally save the object's state, supporting lossless restoration later; decouple the 'state snapshot' from the object.
Practice
In progress 0/4Practice this model in one real situation:
Cases
- Editor undo; game save; before a decision, write down feelings and basis, review half a year later to calibrate intuition.
Common pitfalls
- Storing state inside the object breaks encapsulation; saving but never loading; abusing snapshots causing memory bloat.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- en.wikipedia.orghttps://en.wikipedia.org/wiki/Memento_patternverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS