Re: Implementing Undo.

On Fri, Aug 27, 1999 at 04:19:40PM +0200, Laurent Gauthier wrote:

>  >    Does anyone know of software patterns for implementing Undo with
>  > different kind of changes in a document?  I want to implement
>  > Undo/Redo in Gnumeric.
> Yes, I'm looking in this issue right now for an application I'm
> working on.  If you have the book titled Design Patterns (by Gamma,
> Helm, Johnson, Vlissides) there are several Undo related patterns:
>   Memento

Basically a snapshot of something's state.

>   Command

An encapsulation of a generic action (deleting a row, opening a document,
resizing a window, whatever).

>   and probably others...

FWIW, I've always used Command (or an equivalent, modified for non-OO
systems). (Design Patterns actually hints that, even if you use the Memento
pattern to allow you to return to an earlier state on the Undo action, you
wrap it up in the Command pattern.)

I'd _imagine_ that, unless you spend quite a lot of time being clever, not
using Mementos will be more efficient in Gnumeric. Don't even think of
holding me to that though :-)


  James Aylett                                                           

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]