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: memento/README.md
+171-2Lines changed: 171 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,177 @@ tags:
12
12
Token
13
13
14
14
## Intent
15
-
Without violating encapsulation, capture and externalize an
16
-
object's internal state so that the object can be restored to this state later.
15
+
Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored
16
+
to this state later.
17
+
18
+
## Explanation
19
+
Real world example
20
+
21
+
> We are working on astrology application where we need to analyze star properties over time. We are creating snapshots of star state using Memento pattern.
22
+
23
+
In plain words
24
+
25
+
> Memento pattern captures object internal state making it easy to store and restore objects in any point of time.
26
+
27
+
Wikipedia says
28
+
29
+
> The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback).
30
+
31
+
**Programmatic Example**
32
+
33
+
Let's first define the types of stars we are capable to handle.
0 commit comments