Memento Pattern Explained | Memento Design Pattern Tutorial with Java Example for Beginners

preview_player
Показать описание
Memento design pattern is a behavioral design pattern. Memento design pattern lets you save and restore the previous state of an object without revealing the details of its implementation. Memento is an object that stores a snapshot of the internal state of another object. This pattern allows you to save the internal state of an object to restore it later. As your application is progressing, you may want to save checkpoints in your application and restore back to previous state if anything goes wrong.

Memento Design pattern defines three roles for objects.
1. Originator is the object whose state we want to save.
2. Memento is another object that saves the state of the Originator.
3. Caretaker manages the timing of the saving of the state, saves the Memento and, if needed, uses the Memento to restore the state of the Originator.

** Example of Memento Design Pattern **
Imagine that you’re creating a text editor app. In addition to simple text editing, your editor can format text, insert inline images, etc. At some point, you decided to let users undo any operations carried out on the text. For this implementation, your app should record the states of all objects and saves it in some storage. Later, when a user decides to revert an action, the app fetches the latest snapshot from the history and uses it to restore the state of all objects.

** Where to use Memento Design Pattern **
1. When letting some info in an object available by another object.
2. When you want to create snapshots of a state for an object.
3. When you need undo/redo features.

** Advantages of Memento Design Pattern **
1. Ability to restore an object to its previous state.
2. It stores the objects state without compromising encapsulation.
3. Provides a recovery mechanism in case of failures.
4. It provides a way to maintain history of an object's life cycle.

** Chapter Timestamps **
0:00 Welcome to Memento Design Pattern
0:25 Recap of Mediator Design Pattern
1:25 Introduction to Memento Design Pattern
2:07 Actors of Memento Design Pattern
2:35 Real World Example of Memento Design Pattern
3:12 Java code example of Memento Design Pattern
8:15 Where to use Memento Design Pattern
8:41 Advantages of Memento Design Pattern
9:03 Summary of Memento Design Pattern
9:46 Next video on Interpreter Design Pattern

#mementopattern #mementodesignpattern #designpattern

** Previous Video Links **

** GITHUB Project **

** CHECK OUT OUR OTHER VIDEOS **

** CHECK OUR PLAYLISTS **
Docker Containers Complete Tutorial
GITHUB Repository Tutorial | Complete Guide to GITHUB for Beginners


** Acronyms **
OOP – Object Oriented Programming Languages
GOF – Gang of Four Design Pattern
COD – Code One Digest

** ABOUT OUR CHANNEL **
CodeOneDigest is a youtube channel that produces videos on programming languages, cloud and container technologies, Software design principles, Java frameworks in English and Hindi languages.
Dosto, CodeOneDigest youtube channel pe aapko programming languages, container technology, cloud computing, software engineering se related videos milenge.

Check out our channel here:
Don’t forget to subscribe!

** OUR WEBSITE **

** GET IN TOUCH **

FOLLOW US ON SOCIAL - LIKE, SHARE & SUBSCRIBE
Get updates or reach out to Get updates on our Social Media Profiles!

spring boot, spring framework, adapter design pattern, flyweight design pattern, design patterns in java,
Рекомендации по теме
Комментарии
Автор

Hello friends, a new #video on #memento #design #pattern with #Java #code #example is published on #codeonedigest #youtube channel. Memento #designpattern #tutorial for students. Enjoy #programming #coding with #codeonedigest

#mementodesignpattern #mementodesignpatterninjava #mementodesignpatterninhindi #mementodesign #mementodesignpatternjava #mementopattern #mementopatterninjava #mementopatternjava #javadesignpattern #designpattern #softwaredesignpattern #behavioraldesignpattern #designpatterns #designprinciple #viral #trending #viralvideo #mementopatternexplained #mementodesignpatternexample #mementopatternexample #gangoffourdesignpatterns #gofpatterns #gofpattern

codeonedigest
Автор

Excellent. I watched so many videos on Behavioural design pattern. But i understood clearly only in this video. Thank you

manikandan
welcome to shbcf.ru