Dynamic Proxies and Mediators

10 views
Skip to first unread message

Joel Hooks

unread,
Jul 16, 2009, 3:42:51 PM7/16/09
to RobotLegs AS3
In PureMVC I pass an identifier into the constructor of my dynamic
proxy and mediator classes. How would I handle this in Robotlegs?

darscan

unread,
Jul 17, 2009, 5:26:44 AM7/17/09
to RobotLegs AS3
Hi Joel,

I assume you figured this out (judging by the fact that you built a
demo app!), but will give a proper response later anyway.

Joel Hooks

unread,
Jul 17, 2009, 10:02:05 AM7/17/09
to robo...@googlegroups.com
No, I still haven't figured it out. Say I have a customer with several
image galleries they can view, and I want to proxy all of the image
gallery value objects. In PureMVC I pass a UID to the proxy and then
override its getProxyName() to include the UID so when I want to refer
to it I have a unique hook.

http://forums.puremvc.org/index.php?topic=596.msg3148#msg3148

I can't get my head around how to do this with injection.

Joel Hooks (@jhooks)
http://joelhooks.com

darscan

unread,
Jul 18, 2009, 8:22:51 AM7/18/09
to RobotLegs AS3
Aha, well we could add to the injector interface, something like:

function getInstance( ofClass, named:String = null ):*;

But obviously that turns the injector back into a model/service
locator - which leads straight back to:

Untyped registry.. no type hinting.. lots of casting
Extra knowledge (naming scheme) and code required at every touch
point.. duplication... knowledge smear
Reminds me of _root["menuItem"+i]

I feel that, on the Model side, this style can (and should) be
avoided. Often, a bunch of value objects belong in a collection - a
single collection (in that context/application), that could be
accessed through one Proxy. I don't think that they should be thrown,
side-by-side, into a registry, and accessed by string keys.

At the same time, I do understand that it's convenient. And at the end
of the day, internally, the framework is using the injector like that
anyway, so we may as well expose it for use in really tricky/rushed
situations.

What do you think?

On Jul 17, 4:02 pm, Joel Hooks <joelho...@gmail.com> wrote:
> No, I still haven't figured it out. Say I have a customer with several  
> image galleries they can view, and I want to proxy all of the image  
> gallery value objects. In PureMVC I pass a UID to the proxy and then  
> override its getProxyName() to include the UID so when I want to refer  
> to it I have a unique hook.
>
> http://forums.puremvc.org/index.php?topic=596.msg3148#msg3148
>
> I can't get my head around how to do this with injection.
>
> Joel Hooks (@jhooks)http://joelhooks.com

Joel Hooks

unread,
Jul 18, 2009, 9:27:59 PM7/18/09
to robo...@googlegroups.com

> Untyped registry.. no type hinting.. lots of casting
> Extra knowledge (naming scheme) and code required at every touch
> point.. duplication... knowledge smear
> Reminds me of _root["menuItem"+i]
>
> What do you think?

You have me rethinking the architecture of ALL my applications now. I
think I've been abusing my model. ;)

Interesting stuff sir, thanks for challenging my comfort zone.

Reply all
Reply to author
Forward
0 new messages