Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

| * |

  Show Posts
Pages: [1] 2
1  Announcements and General Discussion / Getting Started / Listening to Notifications on Mediators or going through commands on: October 23, 2009, 03:10:48
I have a small dilemma, so far through the documentation we can see how Mediators are able to listen to notifications which is really easy to implement. But I have found that using Commands for all my calls makes me feel more comfortable in that I dont have to tie my mediators to certain Proxies when there are changes to them but rather Commands are tied up to Proxy and Mediator Notifications.

This feels more natural forcing me to create my Mediators/Views/Proxies more open and not having references (or importing) from each other but they just expose their APIs which the controls are able to use as needed.

What is the general consensus in regards to this approach? I remember reading/listening something about Cairngorm using this method so in general I found the following

Allowing Mediators to listen for events
- faster development
- have to add references to other actors within the class
- less commands

Go through the Commands:

- slightly development
- lots of commands
- loose coupling ( not having to import classes to mediators/proxies)
2  Announcements and General Discussion / Getting Started / Example of when is necessary to remove elements? on: October 05, 2009, 11:01:41
When is it a good time to remove elements (Proxy,Mediator,Commands) from the facade? Would it be "better" to leave all the assets available rather than subscribing/unsubscribing?
3  Announcements and General Discussion / Getting Started / Is it ok for Proxies to gather information from other Proxies on: October 05, 2009, 10:56:28
Is it ok for Proxies to gather information from other Proxies or should I be going the other way around.

This is how my aplication is working:

User dispatches an event
Mediator sendsanotification
Command gathers that notification
ProxyA needs information from VO that belongs to ProxyB.

In this case, should I go all the way around and get a reference from ProxyB to gather the information I need from the VO that is connected to ProxyB or should I just get a reference to that VO directly on ProxyA.

The only issue why I am hesitant to get a direct reference on ProxyA and ProxyB from the same VO is because ProxyB is making changes to the VO.
4  Announcements and General Discussion / Getting Started / Properties from a View exposed or added to a VO? on: September 29, 2009, 08:50:51
I have a simple property on a view (ID) and I need the mediator get a hold of that property when an event happens. The Mediator does not trigger the event but the user does by interacting with the view.

Here is where I am confused. I do want my view to cooperate with pureMVC but at the same time I want my view to be reusable with other applications. In the login sample from Best Practices the buttons are tied up to a VO which makes me feel that the View is already being tied to a specific VO so if I need to move it to a different application the VO needs to go with it, and with so I feel it breaks encapsulation.

So I thought I can either expose the property (or create/get-set methods) but then would this modify the PureMVC framework?
5  Announcements and General Discussion / Getting Started / Properties of views and manipulation on: September 27, 2009, 12:11:55
When creating views that have different properties that will be manipulated, in the purist point if view will the proper way to hold and manipulate this properties will be proxy/vo? or would it be just ok with doing it directly from the mediator/view?
6  Announcements and General Discussion / Getting Started / Organizing Components with sub components on: September 26, 2009, 11:00:03
What is the best method to organize components that have sub components or sub views.

For example, say you are building a car class and you have your

CAR

door
/handle
./handleinnerstuff

engine
/radiator
./waterlevelinradiator

Is that the best way to create "complex" components? Or would it be best to create them all inside the view folder?

door
handle
handleinnerstuff
engine
radiator
waterlevelinradiator

I have seen people do the above and it is ok in smaller apps but when you have really complex apps then it gets really messy.

another thing I was looking at was the multicore version of puremvc but that is way over my head right now as I am getting used to the standard version.
7  Announcements and General Discussion / Getting Started / Why would you want to register a Proxy through a command? on: September 26, 2009, 09:25:42
Why would I want to register a Proxy through a command rather than registering it directly through a Mediator?

I was wondering why would you do that, specially during instantiation but the more I was reading about the subject I discovered that the benefit of doing this through a command is that then I have the ability to call the proxy methods through the Command when necessary rather than being tied up with a specific Mediator.

From the Docs:
Preparing the Model is usually a simple matter of creating and
registering all the Proxies the system will need at startup.
 
The ModelPrepCommand above is a SimpleCommand that prepares
the Model for use. It is the first of the previous MacroCommand’s
sub-commands, and so is executed first. 
 
Via the concrete Façade, it creates and registers the various Proxy
classes that the system will use at startup. Note that the Command
does not do any manipulation or initialization of the Model data. The
Proxy is responsible for any data retrieval, creation or initialization
necessary to prepare its Data Object for use by the system.


Could some one confirm my thoughts?
8  Announcements and General Discussion / Getting Started / Who takes ownership of the views and the notifications? on: September 25, 2009, 12:57:30
I have a navigation view which then creates sub views (or buttons):

component
/navView
/buttonView

Should the events bubble from the buttonView -> navView-> navViewMediator or is it best to let each buttonView talk directly to the Mediator?

The buttonView pretty much creates a complex view that is several lines of code and that is why I decided to create a viewClass of its own, but nothing else is going on in there other than the complexity and dispatching events (rollover/rollout/click).
9  Announcements and General Discussion / Getting Started / Is it ok for a mediator to make calls like this? on: September 24, 2009, 12:53:00
//in ApplicationMediator

      override public function handleNotification(notification:INotification):void 
        { 
            var name:String = notification.getName(); 
            var body:Object = notification.getBody(); 

            switch ( name ) 
            { 
                case BrowserProxy.DATA_READY:
               var setingsProxy : SettingsProxy = facade.retrieveProxy ( SettingsProxy.NAME ) as SettingsProxy ;
               setingsProxy.settingsDataGet();
                break; 
      
            } 
        }

The ApplicationMediator is the only one who cares if the Browser Settings have been set. Once that is completed then we need to make a new call to SettingsProxy to get information from a XML.

Again this works perfectly but I am wondering about this in regards to best practice.
10  Announcements and General Discussion / Getting Started / Where do we place general utilities on: September 24, 2009, 09:10:11
I have a piece of code that could be used by different applications. It is used by a proxy twice for the life of my current app and I could just add it to the proxy but say I want to move that piece of code as an utility. Is there any specific utils folder within the framework? I couldn't find anything within the docs for best practices.

I would assume this is more left up to us than something specific to the framework.
11  Announcements and General Discussion / Getting Started / Proxy that does not need to interact with any component at first on: September 24, 2009, 07:55:28
I have a piece of data that needs to be gathered from the browser at the begining of the application. The Data will be used by the application and it is imperative that is available in order for the app to work.
      
Most examples that I have seen are used where Proxys send informations during the life of the app.
      
What I am doing right now is to register the Proxy during the StartupCommand, so do I just register the rest of the actors and have them listen for the event that allows the application to run?
      
I am sure I making this more complicated than it should be.

I have taken the time to look at StateMachine but the more I studied it the more confused I was getting so I am back to square one, where I can understand all the basics properly and then add those new items.
12  Announcements and General Discussion / General Discussion / Mediators Send, Declare Interest In and Receive Notifications on: June 25, 2009, 02:08:21
From the documentation:

When they are registered with the View, Mediators are interrogated
as to their Notification interests by having their listNotifications
method called, and they must return an array of Notification names
they are interested in. 
 
Later, when a Notification by the same name is sent by any actor in
the system, interested Mediators will be notified by having their
handleNotification method called and being passed a reference to
the Notification.

Here is my question. I have views within my views like this:

top level view -
---mediator
-------low level view

now the "low level view" is instatiated by the mediator and it is basically a button. I am able to send a notification from the "low level view" that the mediator recognizes and is able to process correctly but I am 100% percent certain this is not the way to go. Having access to the facade from any place makes it easier to send notifications from any where but is that beneficial?
13  Announcements and General Discussion / General Discussion / Using MacroCommand with StartupResourceProxy utility on: June 22, 2009, 03:08:49
I have an example that I am following and works great with the Simple command, but I also have another example that uses MacroCommands, honestly I like how the project is layed out with the Macrocommand
         
EXTENDING MACROCOMMAND:

:
override protected function initializeMacroCommand():void
{
addSubCommand( command1 );
        addSubCommand( command1 );
        addSubCommand( command1 );
}
            
VS
            
EXTENDING SIMPLECOMMAND:

:
override public function execute( note:INotification ): void
{
40 lines of code here that with subcommands they could all be broken into their own class.....
}
                  
one thing that I can't live without is a "monitor" that keeps track of what assets are being added to the StartupResourceProxy so I am forced to put everything in one class.
            
:
private function makeAndRegisterStartupResource( proxyName:String, appResourceProxy:IStartupProxy ):StartupResourceProxy
{

var r:StartupResourceProxy = new StartupResourceProxy( proxyName, appResourceProxy );
 facade.registerProxy( r );
_monitor.addResource( r );
return r;
}
         
My idea of distributing everything in subcommands is creating another Proxy that would keep track of the resources being added and provide feedback but this seems to be over work, is that the correct way to handle this issue?
            
14  Announcements and General Discussion / General Discussion / StateMachine Sample Door on: June 22, 2009, 01:52:17
In the statemachine presentation in puremvc.org there is the mention of a door handle as an application to this concept. Is there source code for such application out there?
      
There reason why I am asking is because I don't know where to start in regards to the instatiation of the class. Granted the presentations go in great detail on where to place the XML and how to declare your states but the basics of where do you instatiate the class are left behind.
      
I apologize for those who seem this request rather absurd or noobish. There are some of use out there who would greatly benefit from this information. Just right now I am working on a project where I need to save the state of the application and I would like to use the StateMachine but I am not sure where to place it.
      
15  Announcements and General Discussion / General Discussion / Proxies or ValueObjects on: May 06, 2009, 02:19:31
So far i have been using the value objects to hold data that a proxy can retrieve and dispatch an event when the update has been completed. I have a small dilema. I have to keep somehow the state of the application, the application can have 3 positions and i need to keep track of the position of when it changes or when it has been changed. In this case do I need to write a Proxy that will wrap a VO with this information?
   
It might look like a lot of work at first just to keep track of onee property but I want to be able to do it right with small items to be ready when I need to apply the same concept to a larger scale.
Pages: [1] 2