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
PureMVC Architects Lounge
PureMVC Manifold
Port to AS3
MultiCore Version
VIEW <-> PROXY
Pages: [
1
]
« previous
next »
Author
Topic: VIEW <-> PROXY (Read 11254 times)
aviddv1
Newbie
Posts: 1
VIEW <-> PROXY
«
on:
July 19, 2009, 01:03:12 »
Hey there,
I'm new to PureMVC and thus far I'm loving it. I love how organized it's forcing me to be. I have a two-part question about views and proxies. I completely understand the importance of keeping them decoupled, however (and maybe I'm just doing this all wrong), I find myself needing about 12 parameters from a proxy in order to set things like colors, width, an array of items, etc. I understand I can have the mediator get all of these items and just pass them to the view, however wouldn't it just be more efficient if I can talk directly to the proxy from a view? I've even tried breaking up my code so some of the dependency on data from the proxies is handled inside the mediator.
Bottom line is how can I pass a large number of parameters without creating parameter objects then parsing them within the views?
Part two of my question has to do with nested views. If Im creating a view that is a menubar and within the view I have a number of links which are created dynamically from a link view, can I add the link view directly into the menubar view? If I have to use a mediator wouldn't I have to add one for each instance of the link view?
If I'm able to add each instance of the link view directly to my menubar view I've got to think about a whole new set of parameters originating from the proxies that need to be passed through the menubar view to the link views so they can be configured.
Am I going about this all wrong? My goal is:
Menubar View
- Link View (instance 1)
- Link View (instance 2)
- Link View (instance 3)
- etc.
Thanks,
Howie
Logged
Sammi
Courseware Beta
Full Member
Posts: 45
Re: VIEW <-> PROXY
«
Reply #1 on:
July 20, 2009, 04:11:25 »
Hi,
First:
I would just make a VO for these properties and have the mediator pass it to the view. It may sound like a lot of extra work, but it really isn't. And you get code completion for the properties.
Second:
I would just have a MenuBarMediator that manages both the MenuBarView and it's nested views. I would actually also not have the links as 'views'. They could be classes, but I would not think of them as views in PureMVC terms. That would be too granular for my taste.
Best,
Sammi
Logged
puremvc
Global Moderator
Hero Member
Posts: 2871
Re: VIEW <-> PROXY
«
Reply #2 on:
July 21, 2009, 07:57:27 »
The Value Object pattern (VO) that Sammi mentioned is the right answer here. It is a simple class with all the props needed and you can pass that across from the Proxy to the Mediator in a note body. Or the Mediator can retrieve the Proxy and get the VO with a single call and set it on the view component with a single call.
Spoon-feed your components in this way, don't have them talking directly to Proxies or you'll be making the very coupling that MVC is intended to avoid.
-=Cliff>
Logged
Pages: [
1
]
« previous
next »
Stack Overflow
GitHub
Linked In
Google Plus
Twitter
Powered by SMF 2.0.15
|
SMF © 2006-2007, Simple Machines LLC
|
Content © 2006-2018, Futurescale, Inc.
Loading...