Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Undo features...

 
Gurumurthy Ramamurthy
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

Undo features can be accomplished using Memento pattern, also I have learnt that it is possible with command patter too...How?

thanks
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might prefer the OO, UML, etc. forum down the page for questions like this. We love this kinda stuff down there.

Memento can be used for undo by storing all state or the state that changes on every change. To undo you simply restore the most recent saved state.

Command can be used to undo by storing compensating commands. To undo you execute the most recent command. So if the change was to insert a new row in the database the undo might be a matching delete command.

I've seen these used in transaction rollback. If you update a database and a flat file in a transaction, you probably have to write your own rollback for the flat file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic