You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: BehavioralPatterns/Memento/README.md
+22-14Lines changed: 22 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -17,18 +17,6 @@ Only the originator that created a memento is allowed to access it.
17
17
18
18
A client (caretaker) can request a memento from the originator to save the internal state. It can also pass a memento back to the originator to restore to a previous state.
19
19
20
-
## Benefits
21
-
22
-
* Does not violate the originator's encapsulation.
23
-
* Keeping the saved state external from the originator helps to maintain cohesion.
24
-
* Provides easy-to-implement recovery capability.
25
-
26
-
## Drawbacks
27
-
28
-
* Saving and restoring state can be time consuming.
29
-
* It may require lots of memory if clients create mementors too often.
30
-
* Clients should track the originator's lifecycle in order to destroy obsolete mementos.
31
-
32
20
## Common Structure
33
21
34
22

@@ -44,7 +32,21 @@ A client (caretaker) can request a memento from the originator to save the inter
44
32
* never operates on or examines the contents of a memento
45
33
* When originator has to go back in history, the caretaker passes the last memento to the originator's restoration method.
0 commit comments