Out of curiosity, what is it you want to do when the login happens.  I have only found a few things that were difficult to do from within a command.  If you can tell me what you want to do, I can tell you what I have done in the past and how I accomplished it from within a command.  In my Cairngorm trials, I had come to some of the same thinking as you described here, but I found that there were ways to accomplish it within the command instead of a management class.  There were situations I chose to implement management classes though, for example, I had a class that managed all the media playing on a media player I am building…  It just didn’t feel right broken into commands, just didn’t feel very cohesive, although accomplishable through commands, just felt better in a singleton class….  Especially since I was going to be using these same functions across many different commands and didn’t want to rewrite the logic in each command.

 


From: [email protected] [mailto:[email protected]] On Behalf Of Derrick Grigg
Sent: Wednesday, October 25, 2006 12:11 PM
To: [email protected]
Subject: [flexcoders] Cairngorm, dispatching application events and managing states

 

Here's a question for any Cairngorm devotees to weigh in on.

I have an application that has many seperate parts that function
independently of each other. Each part uses the centralized Cairngorm
fare (FrontController, ModelLocator, Commands etc). For most parts
using the ModelLocator and bound properties (ie
dataProvider={model.users}) works perfect for keeping everything in order.

One case where this seems to fall apart is when one part or the shell
application needs to notify the other parts of something that has
happened. For example, a user logs into the application. I can update
the model.user to reflect a value object for the new user and the
various components that need to update on this do, BUT, what to do
when I need something programatic to occur in one of the parts.

I have tried unsuccessfully to use the 'mx.binding' classes. I think
the issue there is that when you initially set the binding it is set
to a specific instance of an object (ie model.user). When the user
logs in I typically completely replace the model.user with a new user
instance, which kills the bindings. The only way around this is to
never replace object instances in the model but rather update them.
Thinking this through though, that seems like a ticking time bomb. Any
accidental overwrite of a instance in the model and all the bindings
falls apart.

What I have done in past, pre Cairngorm, applications it to create
Manager classes, based on the Singleton pattern, that can dispatch
events, and perform logic that doesn't really belong in a command or
business delegate. For example an ApplicationManager class that can
dispatch 'loggedIn' and 'loggedOut' events. Any part of the
application can register as a listener and act appropriately upon
receiving the event.

My question then (to get to the point), is using a Manager class like
this considered a best practice in the Cairngorm framework (mindframe)
or is there a better or more acceptable method of doing what I would
like to accomplish?

Thanks in advance for any feedback,

Derrick

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to