␡
- A Classic Example: Using Memento for Undo
- Memento Durability
- Persisting Mementos Across Sessions
- Summary
This chapter is from the book
Memento Durability
Memento Durability
A memento is a tiny repository that saves an object’s state. You can create a memento by using another object, a string, or a file. The anticipated duration between the storage and reconstruction of an object has an effect on the strategy that you can use in designing a memento. The time that elapses can be moments, hours, days, or years.
Challenge 19.3
Write down two reasons that might drive you to save a memento in a file rather than as an object.
A solution appears on page 402.