Memento Design Pattern

Type : Behavioral Design Pattern Summary Memento design pattern is used when we want to save the state of an object so that we can restore later on. Advantages The memento pattern provides a way of recording the internal state of an object in a separate object. Memento design pattern removes need for multiple creation of the same object for the sole purpose of saving its state. The memento simplifies the Originator since the responsibility of managing Memento storage is no longer centralized at the Originator but rather distributed among the Caretakers. Disadvantages As the Memento object stores the data of the Originator object, it generally copies the fields that represents state of the originator. Changes in the Originator object could force to change the memento object also. Details Memento design pattern is used when we want an option to to get previous state or restore previous version of objects. It has three key compone...