December 2021
Intermediate to advanced
352 pages
10h
English
Suppose you would like to save the internal state of an object so that you can restore it later. For example, you might want to save the color, size, pattern, or shape of objects in a drafting or painting program. Ideally, it should be possible to save and restore this state without making each object take care of this task and without violating encapsulation. This is the purpose of the Memento pattern.
Objects normally shouldn’t expose much of their internal state using public methods. However, you would still like to be able to save the entire state of an object because you might need to restore it later. In some cases, you can obtain enough information from the public interfaces (such as the drawing ...
Read now
Unlock full access