Update README.md

This commit is contained in:
Petrutiu Mihai
2016-07-18 16:15:59 +03:00
committed by GitHub
parent c15730272d
commit f4d76e8bff

View File

@@ -255,6 +255,17 @@ Mediator class diagram, while it is hard to make a generic one, as it can vary,
### a. Pattern description ### a. Pattern description
The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback). The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback).
[MementoClassDiagram]: https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/BehavioralPatternsDiagrams/Memento/MementoClassDiagram.PNG "Memento class diagram"
[MementoSequenceDiagram]: https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/BehavioralPatternsDiagrams/Memento/MementoSequenceDiagram.PNG "Memento sequence diagram"
Class diagram:
![alt text][MementoClassDiagram]
Sequence diagram:
![alt text][MementoSequenceDiagram]
### b. When to use Memento pattern ### b. When to use Memento pattern
* When you need to be able to track the state of an object,or/and restore previous states as needed * When you need to be able to track the state of an object,or/and restore previous states as needed
* When you cannot use simple operation undo/redo, by saving the commands (when there are side effects to the operations) - example translation * When you cannot use simple operation undo/redo, by saving the commands (when there are side effects to the operations) - example translation