Memento Design Pattern Tutorial

Memento Design Pattern TutorialWelcome to my Memento Design Pattern Tutorial! The Memento design pattern provides a way to store previous states of an Object easily.

It has 3 main classes. Memento: The basic object that is stored in different states. Originator: Sets and Gets values from the currently targeted Memento. Creates new Mementos and assigns current values to them. Caretaker: Holds an ArrayList that contains all previous versions of the Memento. It can store and retrieve stored Mementos. All of the code is down below to help you learn.

If you think videos like this, it helps to tell Google [googleplusone]

Share if you think a friend may like this [nttfblike]

Code from the Memento Design Pattern Tutorial Video

MEMENTO.JAVA

ORIGINATOR.JAVA

CARETAKER.JAVA

TESTMEMENTO.JAVA

10 thoughts on “Memento Design Pattern Tutorial”

  1. Thank you, you helped me a lot!
    Don’t you think to publish a book about Design patterns?
    Do you have some JavaEE tutorial?

    I wish if I’ll have a teacher like you in my class.

    Cordially.

    1. You’re are very welcome 🙂 The pleasure is all mine. It is very gratifying to be able to help others for me. I don’t think I’d ever publish a book just because I feel I can access the whole world online. I don’t have any interest in the money I might make.

      I have not yet covered J2EE. I decided to cover Android in depth instead, but I definitely will cover that topic. I’ll be here as long as possible to teach.

      1. “I don’t think I’d ever publish a book just because I feel I can access the whole world online.”
        Thank you again 🙂

        I have a question if you don’t mind;
        I was looking on the net about the difference between Library, API and SDK?, but I couldn’t find a clear answer.

        Would you please help me to make the difference?
        if it’s possible, I would like some examples.

        Thank you for your answer 🙂
        Cordially.

        1. A Software Development Kit (SDK) contains a bunch of tools that make it easy to create applications. Very often they contain a bunch of classes that rely on a bunch of hidden classes that simplify normally very complicated tasks.

          An Application Programming Interface (API) specification provides an easy way to bounce around and learn about all the classes that are available for you to use.

          A library, or package is just a bunch of classes that can be imported into your code for use.

          I hope that helps
          Derek

Leave a Reply

Your email address will not be published. Required fields are marked *