vendredi 3 mars 2023

Implementing undo/redo for existing application (C++/Multiplatform)

Long story short: A client wants an undo/redo functionality in an application that is already somewhat mature and never had this functionality planned. It does not use command pattern nor any other form of transactioning. On the plus side, data model is relatively decoupled and most of the entities are already serializable.

The question is, how would one approach this having in mind the application is written in C++ and is supposed to run on all three major OSes - Windows, Linus, macOS?

Normally there are two obvious ways to approach this - command pattern or state serialising.

Command pattern in this case will be a huge workload impacting major chunk of the codebase. State serialising seems like an easier solution, but memory efficiency is questionable.

I've read about OS specific ways of doing undo/redo overlay, like using SEH on Win32 to capture writes and save compressed memory deltas. This though sounds to me both sketchy and very platform-specific.

Is there something I am missing, some obscure pattern or hack to do this easier, or am I left with the choice between first two solutions?

Aucun commentaire:

Enregistrer un commentaire