[Catalyst] Use Undo on A List Apart

Wade.Stuart at fallon.com Wade.Stuart at fallon.com
Sat Jul 28 19:26:22 GMT 2007





Matthieu Codron <matthieu at codron.org> wrote on 07/28/2007 11:22:36 AM:

>
> Le 28 juil. 07 à 14:05, Matt S Trout a écrit :
> >
> >>
> >> I like more the idea of a generic undo request. This could be part of
> >> a plugin providing this action and the necessary infrastructure to
> >> implement the "un-doing" of the action.
> >
> > I fail entirely to see why this should be a plugin rather than part
> > of the
> > model you're intending to make mutations upon undoable.
>
> Maybe it does not have to be a plugin. But it can't be exclusively in
> the model layer either, I guess? (I fail to see this one)
> The original idea was to provide a generic /undo action to perform
> the undo. The idea of tagging actions with a "Undoable" annotation
> was to register the action with the undo framework on the controller
> side, so that /undo knows where to forward the undo command.
>
> The actual undoing could reside in the model.

I do not know how this could be generalized for all apps.  In the simple
cases -- maybe.  Consider the following scenarios that you would need to
handle:

* Change happens,  the updated data affects the next 5 actions (via the
current user or another user(s)) and then the user requests an undo --
hard.  Imagine a change such as a picklist item deletion -- where other
users ordering the bundle that place orders after the fact have a bundle
that is limited via the deletion. admin users goes woops and trys to undo
-- now how do you reconcile the state?

* Change happens from multiple sources creating a complex merge list of
different fields -- "undoing" this in different orders or pieces may leave
the data state in a poor state.


Undo (or at least intelligent undo) is a very hard problem in all but the
simplist of shared applications.

The OK or Cancel button is not there because of lazy programming practices,
it is usually there because you are entering a state where a backout is too
hard to do or just does not make sense because of the context.   You may be
better served just putting in undo actions in the places where the action
makes real sense and ignore a list apart's box top screaming.




>
> >> This plugin could implement a simple version of the classic Memento
> >> pattern (http://en.wikipedia.org/wiki/Memento_pattern)
> >
> > I'd say DBIx-Class-Audit (currently in bast trunk pending more
> > testing)
> > already implements this pretty well for DBIC models - except it
> > always saves
> > the appropriate information, saving you needing to call anything at
> > all to
> > make the undo happen.
> >
>
> Did not know of that, thanks for the info!
>





More information about the Catalyst mailing list