Memento

E173617

Memento is a behavioral design pattern that captures and externalizes an object's internal state so it can be restored later without violating encapsulation.

All labels observed (1)

Label Occurrences
Memento canonical 2

How this entity was disambiguated

Statements (47)

Predicate Object
instanceOf behavioral design pattern
software design pattern
allows restoring snapshots of an object’s state
saving snapshots of an object’s state
alternativeName Token (historical name in some literature)
appliesTo objects with complex internal state
systems requiring reversible operations
benefit decouples state storage from state management logic
maintains encapsulation boundaries
supports multiple levels of undo
category Gang of Four design pattern
describedIn Design Patterns: Elements of Reusable Object-Oriented Software
drawback can consume significant memory if many mementos are stored
may incur performance overhead when frequently capturing state
encapsulationLevel hides implementation details of originator’s state representation
ensures only the originator can access its own internal state in the memento
originator’s internal state is not exposed to the caretaker
hasConstraint must not violate encapsulation
hasIntent allow restoring an object to a previous state
capture and externalize an object’s internal state
hasParticipantRole Caretaker
Memento self-linksurface differs
Originator
preserves encapsulation of the originator object
relatedTo Command
surface form: Command (design pattern)

Prototype
surface form: Prototype (design pattern)
responsibility creates mementos capturing its internal state
keeps track of mementos
passes mementos back to the originator for restoration
provides state back to the originator when requested
requests mementos from the originator
restores its state from a memento
stores the internal state of the originator
roleInPattern Memento (design pattern)
Memento (design pattern)
Memento (design pattern)
supports non-invasive state restoration
typicalImplementationDetail caretaker treats mementos as opaque objects
memento is immutable after creation
typicalUseCase games saving and loading checkpoints
graphical editors with history of operations
text editors with undo and redo
transactional systems needing rollback
usedFor implementing rollback functionality
implementing undo mechanisms
state checkpointing
time-travel or history features in applications

How these facts were elicited

Referenced by (2)

Full triples — surface form annotated when it differs from this entity's canonical label.

Memento hasParticipantRole Memento self-linksurface differs
subject surface form: Memento (design pattern)