Skip to content

Latest commit

 

History

History

memento

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

💾 Memento

Check out the example folder to see how the pattern is used.

Explanation

Real-world example

Take the example of a code / document editor (i.e. originator), where whenever you write something, the last content is saved in memory (i.e. memento) so that you can get back to it and maybe get it restored using some action buttons or keyboard shortcuts (i.e. caretaker).

In plain words

Memento pattern is about capturing and storing the current state of an object in a manner that it can be restored later on in a smooth manner.

Wikipedia says

The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback).