# Memento Pattern

Record: `arch:memento-pattern`
Kind: pattern
Layer: [Design Patterns Core](https://banes-lab.com/records/layer/design-patterns-core.md)
Severity: contextual
Scope: behavior, state capture, history
Canonical: https://banes-lab.com/ontology#arch-memento-pattern

## Repair

- Refactored by: Capture State as a Memento
- Detected by: external code reconstructing internal state
- Violated by: callers copying an object's private fields to save state
- Measured by: private-field external access count
- Enforced by: [design review](https://banes-lab.com/records/arch/design-review.md)

## requires

- [Encapsulation](https://banes-lab.com/records/arch/encapsulation.md)

## reinforces

- [Information Hiding](https://banes-lab.com/records/arch/information-hiding.md)

## enables

- [Undo/Redo](https://banes-lab.com/records/lex/undo-redo.md)
- [Snapshot/Restore](https://banes-lab.com/records/lex/snapshot-restore.md)

## conflicts-with

- [External State Reach-In](https://banes-lab.com/records/lex/external-state-reach-in.md)

## tensions-with

- [Memory Footprint](https://banes-lab.com/records/lex/memory-footprint.md)

## tensions

- [Memento Pattern Memory Footprint](https://banes-lab.com/records/tension/memento-pattern-memory-footprint.md)
