Lee Lisle Overview Why would we use Memento Examples of Memento How to implement Memento Why Memento Undo Checkpointing Saving a programs state Examples Rectangles See Design Patterns book ID: 490399
Download Presentation The PPT/PDF document "Memento Design Pattern" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Memento Design Pattern
Lee LisleSlide2
Overview
Why would we use Memento?
Examples of Memento
How to implement MementoSlide3
Why Memento?
Undo
Checkpointing
Saving a program’s stateSlide4
Examples
Rectangles
See Design Patterns book,
Memento section
Not a direct example
Re-use of a method doesn’t guarantee the same
resultSlide5
Mementos in GamesSlide6
How to use Memento
Three “actors” in a Memento
The Memento Object
The originator
The caretaker
Ideally the Memento is not stored by the Originator
Enables “saving”
The Caretaker keeps the object but doesn’t read it
Wide versus Narrow Interfaces (friend descriptor in C++)Slide7
Java Example – Wikibook
Computer Science Design Patterns
https://
en.wikibooks.org/wiki/Computer_Science_Design_Patterns/MementoSlide8
Memento Design Pattern
Why?
Memory
What?
Timing for solvers
Games
How?
Caretaker
, Originator,
Memento
Works Cited
Gamma, Erich.
Design Patterns: Elements of Reusable Object Oriented Software.
Addison-Wesley Professional. 1995.
Memento.
https://en.wikibooks.org/wiki/Computer_Science_Design_Patterns/
Memento
. January 2014. October 2015.