Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Interesting view on Memento pattern

Andrew Perepelytsya
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, ranchers.
Reading the following memento pattern definition

Without violating encapsulation, capture and externalise an object's internal state so that the object can be restored to this state later.

, I came up with a sudden thought that DTO J2EE pattern is building on this one. First, the facade session bean accepting and returning DTOs has a role of Caretaker, and DTO is a Memento for the entity bean.
Concerning the definition 'can be restored'. This is accomplished by passing a populated DTO to the facade, and the bean updates the entity bean to reflect the state.
This all is quite a high-level view from an unusual angle, so don't take it too seriously. But I would like to here from you, people, if my thoughts went in the right direction.
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!