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]
Author Topic: Shared proxy in modular application?  (Read 7490 times)
Full Member
Posts: 26

View Profile Email
« on: August 05, 2009, 10:34:18 »

I am trying to create an application where main view shows users(in a list component) and cars for each user(in datagrid component).

Application has 7 modules:
MainDisplayModule - module with list, datagrid component and buttons 'Add User', 'Remove User', 'Edit User', 'Add Car', 'Remove Car', 'Edit Car'

UserCreatorModule - module with UserCreator(popup window) component - FirstName, Age textInputs, OK and Cancel button
UserEditorModule - module with UserEditor(popup window) component - FirstName, Age textInputs, OK and Cancel button
UserRemoverModule - module UserRemover(popup window) component - FirstName label, OK and Cancel button

CarCreatorModule - module with CarCreator(popup window) component - Make, Model, Year textInputs, OK and Cancel button
CarEditorModule - module with CarEditor(popup window) component - Make, Model, Year textInputs, OK and Cancel button
CarRemoverModule - module CarRemover(popup window) component - Make, Model, Year label, Ok and Cancel button

Having separate modules for popups gives me States and Substates in this application :).
Modules are connected with Pipes and each core(module) has its own StateMachine.

I have CarsProxy with methods addCar(car:CarVO), removeCar(car:carVO), getCars(), cars() and UsersProxy with methods addUser(user:UserVO), removeUser(user:UserVO), getUsers(), users().

Proxies add, remove and retrieve records from/to MySQL server.

Should I place CarsProxy, UsersProxy in a common library?

I dont know but i was thinking about creating another module(ServiceModule) and connecting it with modules. Modules could send and receive messages from/to ServiceModule. Is it a good practice?
Do you have a different approach?

I use Flex/Multicore, StateMachine, Pipes Utility.

Mariush T.
Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #1 on: August 07, 2009, 07:38:53 »

There are lots of ways to plumb an app; the best way really depends on your specific app's needs.

Sometimes, I find that I'm able to have each module communicate with it's own service and also manage all or most of the view components that consume that data, if the views and services are unrelated enough.

But other times, having the proxies inside each module can be a pain, if one module needs access to a proxy in another module. At these times, its better to concentrate the shared proxies into 'Service Adapter' modules that do nothing but talk to services. Send them a message and wait for the response. This works well when many 'visual' modules need access to the same services. It does force you into an asynchronous form of communication.

A mix and match can also work. You might have 3 separate modules that talk to separate services but all three talk to a 4th that communicates with services required by the other three modules.

Pages: [1]