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

Pages: [1]
Print
Author Topic: Multi instances of proxy and mediator  (Read 6182 times)
crilbit
Newbie
*
Posts: 3


View Profile Email
« on: December 30, 2009, 11:54:06 »

Hello,

I try using puremvc on a real backoffice application and some questions of "best practice" appears during implementation.

1. does the proxy have to hold only one data ?
I made a UsersProxy that hold the list of user of the application but i also have to keep the current logged user. Do i have to make another seperate proxy or can i add another property and method to my users proxy ?

2. Multi instance of proxy and mediator ?
This is what i m' the most confuse with puremvc. When i have multi instance of mxml component in my application. For example a list of user that can appear in several view.
All the mediator that send notification can use type argument as discrimination.
1.Then i can use one instance of userProxy that save the type, use delegate to retrieve data and send back notification passing the saving type.
2.Or use multi instance of proxy create or retrieve in the command using the type as name.

And some time the mediators are register in other mediator so the discriminator need to be passed through several mediator.
I wonder if it is not too laborious to passe the type from mediator to command to proxy (with asynchronous request) and then back to mediator in big application.

So a lot of question but as i really enjoy the global architecture of puremvc i would like to build application in the most "academic" way.

Thank you for any help or suggestion

Cyril Balit



« Last Edit: December 30, 2009, 12:21:55 by crilbit » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: January 01, 2010, 08:08:50 »

:
1. does the proxy have to hold only one data ?It can hold as much data as you'd like. Usually it's one data type per proxy, with the proxy holding either a collection or an instance of the data type, but it could also keep the 'selected' instance.

:
2. Multi instance of proxy and mediator ?If you want more than one instance of a proxy or mediator just register them with unique names (not the NAME constant that most single-use mediators and proxies use).

-=Cliff>
Logged
Pages: [1]
Print