$> git checkout memento
Intent
Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later.1
Applications
Have you ever seen that movie called Memento 2? The story follows an investigator who can no longer make new memories. He follows clues in order to find a second attacker on his murdered wife. It’s not one of Christopher Nolan’s best movies but it is still worth watching. This chapter has nothing to do with that. I’m not even sure how to relate the movie with the memento pattern. I do love a good Nolan film, though.