Hermes Wiki

Memento

Captures an object's internal state so it can be restored later, without exposing that state's implementation details.

Why we need this / what value this brings

Enables undo/rollback/history without breaking encapsulation of the object whose state is being saved.

When to use this

You need to snapshot and later restore an object's state (undo, rollback a failed multi-step operation, audit history) without the snapshot mechanism needing to know the object's internals.

How to use or implement this

Have the originator produce an opaque snapshot object, held by a caretaker that doesn't inspect it, and restore state by handing the snapshot back to the originator.

Research questions

  • Booking-state rollback (e.g. reverting a booking to its prior state if payment fails) and the RecordsAudit module both look memento-shaped — worth checking whether audit records already act as restorable snapshots or are write-only logs.

Empty folder — drop notes, links, and findings here as you research.

Hermes Wiki