简体   繁体   中英

Design pattern to preview the effect of the Command pattern

What are the existing patterns that allow to preview the effect of the Command pattern on the Model, with acceptable performance (ie no lag in a traditional WIMP GUI) in case of continuous changes of the Command ? For instance in the case of an actualisation of the Command every time a mouse event is received.

original post : We are designing and prototyping a multimedia edition software, and we are facing a problem : we use the command pattern for undo - redo, but we cannot find a way that seems efficient for having a real-time feedback when the user changes something in the GUI. For instance, let's say that you have a box that contains some data, which can be resized. However, the resizing of the Box might imply more that a simple image scaling : a bigger Box could imply apparitions of new elements inside. But this cannot be known before asking the Box model to perform the effective change of its size, since it will in turn call for an update of its underlying components. How, in this case, can we make a "fluid" user interface where the user can resize the Box and see how it changes inside in real time, with only a single Command applied at the end ?

Edit (2015-09-05) : I found another possible design in the book Object-Oriented Programming for Graphics ( http://www.springer.com/us/book/9783642791949 ), especially in the chapter 14 (An Object-Oriented Architecture for Constraint-Based Graphical Editing).

Original : I found an answer (which may not be the best, hence I'm not accepting it since it is an open question) in the following french research paper :

Blouin, Arnaud, and Olivier Beaudoux. 
"Malai: un modèle conceptuel d'interaction pour les systèmes interactifs." 
Proceedings of the 21st International Conference on Association Francophone d'Interaction Homme-Machine. 
ACM, 2009.

The relevant part is "Feedback intérimaire de l'action" on page 7; a state machine is used to represent the running state of the interaction with the software.

However it involves a big departure from an MVP + Command pattern model.

English version :

Blouin, Arnaud, and Olivier Beaudoux. 
"Improving modularity and usability of interactive systems with Malai." 
Proceedings of the 2nd ACM SIGCHI symposium on Engineering interactive computing systems. 
ACM, 2010.

Link : https://hal.archives-ouvertes.fr/file/index/docid/477627/filename/BLOUIN10a.pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM