oopdesign-patternsdtodata-transfer-objectsmemento

DTO pattern vs Memento pattern


What are the differences between DTO pattern(by Fowler) and Memento pattern(by GoF) in motivation and implementation aspect? Can it be the same classes? If yes, how can I name them (xxxDTO or xxxMemento)? Do they have any principal difference in implementation? Where are their place in MVP architecture?

Thanks.


Solution

  • The two are often used for very different things - where are you confused here? DTO is about data transmission (carrier classes), while memento is about keeping track of changes and allowing you to roll those changes back. I am not sure, beyond that, what is confusing you from your question.