> > The distinguishing factor between M2 and MG for controller code is a > name -- controller (MG) or listener (M2). In essense, they act in the > same way. It's merely a semantic difference IMHO. > > On that narrow point, yes. ;) > > MG has the (significant, in my view) advantage that control returns to > the XML after every controller action. With M2, you can announce > arbitrary events in your controllers, and your XML needn't care. MG > forces you to clearly document the flow through the app with the XML.
Yes, you can announce events in your listeners, however you cannot clear the event queue (well, you could if you access some "untouchable" stuff in the request scope). Announcing an event in the listener merely ADDS a new event into the event queue. The current event that processing as well as any other events that are queued in front of that continue to be processed. Your newly announced event is only processed when the framework gets to its' position in the queue. If you want to significantly alter the flow of the application, you need to write a filter -- in which you have access to the event context and the power to clear the event queue. The ability to announce events in listeners is so you can leverage event-mappings -- which are extremely useful. Use your listener to announce a "pass" or "fail" event (literally named "pass" or "fail") and make a mapping in the config file to the correct events. This allows you to reuse "controller" code for generic type events easily. > By keeping the controllers (the the UI flow) tightly bound to the XML, > you can easily see what is the controller and what isn't. > Now if we were all infallible programmers, this wouldn't be an issue. I don't think I see your point. Listeners are "user-defined extensions" of the framework -- they are the glue between Mach-II and your model -- they don't blur the lines of the model or the controller at all. Theorectically, you could write an entire app in listeners (which would be very wrong), but it is totally possible. I believe you could write an entire app in MG's controllers as well -- couldn't you? > Controllers/Listeners are the UI controller and not the model, while > the model is what the controller interfaces with. But I know I'm not > infallible, so it's nice to have those 'guideposts' along the way. Still I don't see your point... Best, ...Peter Maestro Publishing - Member Team Mach-II - Member Team Fusion! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:224739 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

