The theoretical advantage of model-view is that there is better abstraction and 
encapsulation so that one view can be modified and not require coding in the 
other view.

Another advantage of central model may come when you try to hook up to browser 
manager.  It might be easier to reflect some of your UI state in a central 
place and drive the app that way.

From: [email protected] [mailto:[email protected]] On Behalf 
Of Aaron Hardy
Sent: Tuesday, December 16, 2008 6:11 PM
To: [email protected]
Subject: [flexcoders] Architecture options for holding "current" model objects 
related to view


Hey everyone,

Let me set up a situation for you. Let's say you have an application
with a component called Widget1 that's buried deep within the display
list. Widget1 displays 50 knobs. Now, let's say you move to another
part of the application and click a button that instantiates Widget3
which shows certain pieces of information about the knob selected on
Widget1. Within the display list tree, Widget1 and Widget3 are far from
each other and nested deep within other views.

In my experience, developers will usually create a property on the
application's model (ModelLocator in the case of Cairngorm) that's
called something like currentKnob. That way when Widget3 is
instantiated it can know which widget was previously selected in Widget1.

What are the best practices you've seen regarding this type of
interaction within your applications? One alternative I can think of is
if Widget1 dispatches an event off Application that the *creator* of
Widget3 is watching for. Then when the creator of Widget3 actually
creates the Widget3 instance, it can hand off the selected knob to the
instance. Thanks!

Aaron

Reply via email to