Return to site

📐 DESIGN PATTERN: Memento

· pattern

The _____ Pattern is a design pattern that captures and externalizes an object's internal state,

allowing it to be saved and restored later.

It's often used for implementing undo and redo features in applications.

* Pipeline

* Chain of responsibility

* Command

* Memento

#design #pattern #programming #memento #software

Key components of the Memento Pattern:

1) Originator: The Originator is the object whose state needs to be saved. It creates a Memento object to represent its state and can restore its state from a Memento.

2) Memento: The Memento is an object that stores the state of the Originator. It has methods to get and set the state but does not reveal the internal details of the Originator.

3) Caretaker: The Caretaker is responsible for keeping track of and managing Memento objects. It can save and retrieve the Originator's state using Mementos.

broken image