The Memento: Temporal Snapshots
Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Memento
ARCANUM SCHOOL: Chronomancy // State-Preservation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ALLOY PATTERN //
sig SystemState {}
sig TemporalCore {
currentState: one SystemState,
snapshot: one MemoryEngram
}
{
snapshot.savedState = currentState
}
sig MemoryEngram {
savedState: one SystemState
}
sig Archivist {
storedEngram: lone MemoryEngram
}
run {} for 3
The Memento: Temporal Snapshots
The TemporalCore commits its state to a MemoryEngram. Through the constraint block snapshot.savedState = currentState, Alloy ensures that at the exact moment of instantiation, the engram is a perfect, immutable reflection of reality. The Archivist simply holds the pointer, unaware of the arcane state within.
Runic Tags:
#behavioral
#memento
#time