From f4d76e8bffd15c5a5ade5373ae722efa504f3c3a Mon Sep 17 00:00:00 2001 From: Petrutiu Mihai Date: Mon, 18 Jul 2016 16:15:59 +0300 Subject: [PATCH] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index c06ac32..a51d8ff 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,17 @@ Mediator class diagram, while it is hard to make a generic one, as it can vary, ### 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). +[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 * 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