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 the 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.1Write down two reasons that might drive you to saving a memento in a file rather than as an object.

Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.