Skip to content

Commit 71f04d0

Browse files
authored
Create README.md
1 parent f9becf9 commit 71f04d0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

memento/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Memento Pattern
2+
The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback).
3+
4+
The memento pattern is implemented with three objects: the originator, a caretaker and a memento. The originator is some object that has an internal state. The caretaker is going to do something to the originator, but wants to be able to undo the change. The caretaker first asks the originator for a memento object. Then it does whatever operation (or sequence of operations) it was going to do. To roll back to the state before the operations, it returns the memento object to the originator. The memento object itself is an opaque object (one which the caretaker cannot, or should not, change). When using this pattern, care should be taken if the originator may change other objects or resources - the memento pattern operates on a single object.
5+
6+
[Wikipedia: Memento Pattern](https://en.wikipedia.org/wiki/Memento_pattern)
7+
8+
[YouTube: Memento Pattern](https://www.youtube.com/watch?v=jOnxYT8Iaoo&ab_channel=DerekBanas)

0 commit comments

Comments
 (0)