In this action of course we're going to take a look at the memento design pattern and the goal of the
Memento is to keep some sort of token which then allows you to return an object to a particular state.
So what is the motivation for using the mento in the first place.
So as you probably know if you have a system with medieval components then an object or indeed a set
of objects goes through a set of changes.
For example you have a bank account and a bank account gets participated in things like deposits and
withdrawals and that sort of thing.
So as a consequence there are different ways of actually navigating the set of changes or the look that
some of them because one of the ways is to record every single change in the bank account and it would
be the command pattern.
And then you can teach the commands to undo themselves and thereby rolling back the entire sequence.
But another approach is to simply save the snapshots of the system at particular points in time and
then allow the user to roll back the system to a particular snapshot.
So in this case what a memento is it's a kind of a token or a handle that you returned from a method
typically And this represents the system state and it allows us to roll back to the state when the token
was actually generated.
Now the token may or may not directly exposed state information but it's typically an immutable construct
so it may provide a certain amount of information about the state of the system but it doesn't allow
you to actually change the system unless you take this token and you stick it back into the system explicitly
asking it to roll itself back to that particular token.