Update 2: Three days, 70 views and no answer? C'mon people, what is the perfect form? Broadcasting an event from Do(), Undo() and Redo() or what? :)
I ask because someone commented our Redraw() in the Do() function as temp so I wonder what he planned for it to do, and the best I could come up with was to use the listener pattern. But what confuses me is that he didn't engineer the transactions as being an event source, not that it would be too hard to do.
Has anyone used the listener pattern for pagination and drawing and do they see a benefit or from your experience, is it best just to call direct from the transaction? Or maybe you have something even quicker. How do you do it?
Original Question...
I'm trying to make the code perfect, elegant and robust, maintainable blah blah blah and the question is about architecture, style and good practice.
I'm using doc/view architecture. So I have Doc, and DocGUI which have DocElements and parallel DocElementGUIs. I have agent classes that capture the intelligence of how objects should relate. I have transactions (undo/redo) for the insertion of objects (and actions). I have objects responding to one-another with the listener pattern where listeners can register senders and listeners can respond to them.
DocGUI has the Redraw() function that starts the whole chain of events. But for the sake of correctness, I'm not sure what would be best. Should I have Doc register the transaction and listen for a redraw event and then call DocGUI->Redraw() from doc? I guess that would mean that the place to broadcast the event would be at the end of the Do() and Undo() functions of the transaction. What is the way these things are usually done?
Also, I'm not sure, would it be appropriate for DocGUI to be listener? What's the best style, should doc call functions directly or should it direct events? I am seeing that there are ways that make the code more simple and it makes me wonder if there's yet something better that the pros might want to toss out there.
Update, I really should have been asking about Repagination because it would come before Redraw and they would probably both be called from the Do() etc. of the transaction.