The Memento design pattern is a simple but creative programming approach to undoing a change to an object. It involves creating an object with the Memento class that simply details how to go back to the state before the change was made. The solution works because it's set up in a way that means the object still manages itself. See the solution explained in more detail in this online video "Example: the memento pattern."
Next let's take a look at the Memento Design Pattern.…This is a way of managing change, basically a way to undo a change to an object,…but doing it in a way that does not violate encapsulation, and the idea that an…object should always manage itself.…I am going to illustrate this one without code.…This Memento Design Pattern requires three classes that take certain roles, and…we'll call them the Originator, the Caretaker, and the Memento.…So we have the Originator.…This is the object that you want to be able to change, and then undo any changes to.…
For you this could be a customer object, a spaceship object, whatever needs to…be able to reverse out a change.…But the question is who is changing it, who is affecting it?…Well, then we have the object we refer to as the Caretaker.…This object is going to deal with taking care of when and why the Originator…needs to either save its state or to revert back to a previous state.…Now, the Caretaker is often also the object that will actually be changing the…Originator, so it's in a good position to know when it needs to save state.…
Let Simon Allardice introduce you to the terms—words like abstraction, inheritance, polymorphism, subclass—and guide you through defining your requirements and identifying use cases for your program. The course also covers creating conceptual models of your program with design patterns, class and sequence diagrams, and unified modeling language (UML) tools, and then shows how to convert the diagrams into code.
- Why use object-oriented design (OOD)?
- Pinpointing use cases, actors, and scenarios
- Identifying class responsibilities and relationships
- Creating class diagrams
- Using abstract classes
- Working with inheritance
- Creating advanced UML diagrams
- Understanding object-oriented design principles
Skill Level Intermediate
1. Core Concepts
2. Object-Oriented Analysis and Design
Defining requirements6m 9s
3. Utilizing Use Cases
4. Domain Modeling (Modeling the App)
5. Creating Classes
6. Inheritance and Composition
7. Advanced Concepts
8. Object-Oriented Design Patterns
9. Object-Oriented Design Principles
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.