Undo Made Easy With Ajax
humanized.com
humanized.com
Adds, changes, and deletes MUST be done immediately and cannot be queued without bottlenecking the entire system.
Undo's MUST be examined for every possible ramification. What if you change something and then want to undo it AFTER someone else has changed it again? What if you want to undo an add after someone else has already changed it? What about undoing a delete after someone else has added it anew?
Also, distinction must be made on how to handle a client side undo (simple) versus a server side undo (could be complex).
I agree with the writer that undo is a necessity, not a luxury, in a serious web app. For industrial strength apps, however, more thought is needed than what this writer has provided.
The "correct" way to do undo, is to perform an event, and keep a list of inverse events. As you pop those off the undo stack, you can simply execute them.
As you mentioned, this may be slightly more complicated in a multi-user environment -- but in this example, it would absolutely be the right way to go. Plus, this is so easy to get working in javascript, where you can actually push functions to the stack, and then execute them when you pop them off...
1. Hacker news is not the only place to read stuff like this. (although, for me, it sure seems that way now)
2. The children haven't made it here yet. (and hopefully they'll stay where they are)