Command Pattern – Undo and Command Stack

Monday, February 23rd, 2009 | examples

As requested, here’s a demo of the command pattern in action. This example shows how to use the Command Pattern to undo an action. Please watch the video in the previous post before browsing through this source.

Try to focus on how the commands are all added into the command stack, then you’ll see how the stack can be used for undoing, redoing, logging actions, queuing actions, and all sorts of other useful stuff :)

Click on the green, red, and blue boxes to create new circles. Click on the black box to undo.

source

Tags:

  • darien
    it's took me a while to understand the whole flow of the MVC. but i still having hard time understand which one is controller and which one is model
  • hmm... luv it ))
  • мм вот как оказалось !
  • Nice sample, shows perfectly the behavior for the old post. Congratulations John.
blog comments powered by Disqus

Search

Recommended Books

Speaking at FITC Toronto

 

February 2009
M T W T F S S
« Jan   Mar »
 1
2345678
9101112131415
16171819202122
232425262728  

Preferred Video Tutorial Resolution

  • 1024x768 (53%, 85 Votes)
  • 1280x1024 (15%, 24 Votes)
  • 1920x1080 (15%, 24 Votes)
  • 800x600 (13%, 20 Votes)
  • 480x320 (4%, 6 Votes)
  • 640x480 (0%, 2 Votes)

Total Voters: 160

Loading ... Loading ...