[squeak-dev] versioning objects

Michael Davies mykdavies+squeak at gmail.com
Wed Apr 16 21:45:35 UTC 2008


On Wed, Apr 16, 2008 at 4:46 AM, Colin Putney <cputney at wiresong.ca> wrote:
...
>  The usual way to do this is to have all your undoable units of work be
> implemented by "command" objects that know how to perform a specific action.
> Then when the user does something undoable, you create a command, execute
> it, then push it on the undo stack. To undo you can either have the command
> know how to undo its self, or have it create an "inverse" command. This kind
> of thing works pretty well, and it can be extended with other features like
> redo, logging, journal-and-snapshot persistence etc.
>
Jimmy, if you're looking for a relatively simple solution, Apple's
NSUndoManager is a very simple implementation of this idea, though it
does require the programmer to explicitly define the action that will
re-create current state, but it's very easy to implement if it meets
your needs.
(See http://dotnetaddict.dotnetdevelopersjournal.com/nsundomanager.htm
for a fuller description).



More information about the Squeak-dev mailing list