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: best practise for controllers  (Read 7708 times)
pgianf
Newbie
*
Posts: 4


View Profile Email
« on: July 09, 2008, 06:14:39 »

Hi
i've just started in using pureMVC and trying to make the best code distribution among MVC components.
I'm thinking about when and how use controllers. I've seen pureMVC application where mediators call directly proxys without usign commands. So the role of the controller rise only when there is the need to make really complex business job?
for example in a air application what best practice i should use for:
- retreive data from db with a sql query -> mediator calls the proxy which returns an array as result;
- retrieve a list of users from a remote server via HTTP -> mediator calls directly the proxy which call the remote service, process xml, then return a user array
Mainly these are the acttivities involved in my application, nothing more complex like transactions, even if these simple jobs could be done via mediator/proxy is a good practice decouping inserting commands beetwen them?
 
Paolo




Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: July 11, 2008, 05:50:19 »

Sticking a Command between the Mediator and Proxy just introduces another actor into the system, adding complexity. Do it only if there are multiple lines of code to be placed in the command and they need to be reused.

The mediator and proxy are doing a fine job already of decoupling the view component from the model, which is the chief concern of MVC.

-=Cliff>   
Logged
Pages: [1]
Print