The following lists the benefits of using the Memento pattern:
- Preserves encapsulation boundaries
- Simplifies the originator
You should use the Memento pattern when:
- A snapshot of an object's state must be saved so that it can be restored to that state later.
- Using a direct interface to obtain the state would expose implementation details and break the object's encapsulation.
memento: an object kept as a reminder or souvenir of a person or event.