开发者

Lighter & Faster workflow for robotlegs: might be better or it has too many downsides?

开发者 https://www.devze.com 2023-01-26 09:23 出处:网络
Currently I\'m building quite a large app with flex4+robotlegs+as3signals+google app engine based on python.

Currently I'm building quite a large app with flex4+robotlegs+as3signals+google app engine based on python.

1) Well the problem is that I'm finding myself redipsatching the same signals from the view to mediator and from mediator t开发者_StackOverflowo context.

2) The other problem is that I'm executing commands for signals from mediators that just run 1 method on the model.

Remember that working with flex 4, the skin might be separed from the business logic. So I have a skin, a component (SkinnableComponent) for that skin and a model. That is my new approach: the component listen on skin. The component has strong typed model objects (injected) and call methods directly. The component listen for model signals to dispatch. That's all for the components. The mediators are converted in the component. And the command is not used.

Now the problem is: Instead of mapping views (in my case I call them components) to mediators, just map the component with no mediator attached, as is not used. Then allow the component to use the [Inject] metatag.

Just this is what I need, any idea on how to implement it? And of course, I would be glad to hear your oppinion and critcize on it, it always help to improve ;)

thanks for your time! ;)

Codes:

[Skin] dispatches the events caused by the user

[Component] is like a mediator, but quite different as it extends the SkinnableComponent. catch skins events. has a strong typed model. then call direct methods on the model. listen on models. when models dispatch an event the state of component changes.

...
[Inject]
public var accountModel:AccountModel;
[Inject]
public var xxxModel:XxxModel;

// then the component run methods on it and listen on it. easy and no complications.

[Model] they don't know about nothing. just dispatch events or signals.


You're saving yourself a class here, but you are now adding the extra knowledge and responsibility on your view component. This will work, of course, and you might check out my article on using Presentation Models with Robotlegs. I wouldn't recommend it as you describe. If I was going to work this way it would definitely be with a PM.


You might want to have a look at this Adobe TV article by Piotr Walczyszyn

He does a comparison of many DI AS3/Flex frameworks including Robotlegs.

0

精彩评论

暂无评论...
验证码 换一张
取 消