Flex MVC框架 [英] Flex MVC Frameworks

查看:171
本文介绍了Flex MVC框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用和享受使用Flex MVC框架 PureMVC 。我听说了一些关于Cairngorm的好消息,这个消息由Adobe支持,并且已经有了第一个上市的势头。还有一个叫Mate的新玩家,这个玩家有很多嗡嗡声。

有没有人试过两三个这样的框架,并形成了一个观点?



谢谢!

解决方案

伴侣是我的选择。首要的原因是它是完全不显眼的。我的应用程序代码没有依赖框架,它是高度分离,可重用和可测试的。

Mate最好的特性之一就是声明式配置,实质上是将应用程序连接到称为事件映射的标签中 - 基本上是事件列表您的应用程序生成,以及发生什么操作。事件地图很好地概述了你的应用程序的功能。 Mate使用Flex自己的事件机制,它不像大多数其他框架一样创造自己的事件机制。您可以从视图层次结构中的任何位置调度一个事件,并自动将其展开到框架,而不必像Cairngorms CairngormEventDispatcher或PureMVC的通知系统那样拥有直线。



Mate还使用了一种依赖注入(利用绑定)的形式,可以将模型连接到你的视图,而不需要知道其他的。这可能是该框架最强大的功能。



在我看来,其他Flex应用程序框架都不在Mate附近。然而,这些都是竞争者,为什么我认为它们不那么有用:PureMVC主动否定了Flex的许多好处(例如绑定和事件冒泡)为了框架的可移植性 - 我认为这是一个可疑的目标。它也是过度设计的,而且是侵入性的。应用程序的每个部分都依赖于框架。但是,PureMVC并不可怕,只是不太适合Flex。另一种方法是 FlexMVCS ,这个努力使PureMVC更适合于Flex(遗憾的是还没有文档,只是来源)。 Cairngorm是一组反向模式,导致与全局变量紧密耦合的应用程序。纽夫说(但如果你有兴趣,这里有一些我的想法,和 here )。



是一个受Java和Cairngorm Spring框架启发的框架(试图弥补后者最糟糕的部分)。它提供了一个依赖注入容器,并使用元数据来启用依赖关系的自动连接。有意思的是,有一点可以肯定的是,通过使用依赖注入来避免Cairngorm的全局变量,然后使用全局变量来调度中心事件。



那些是我试过或研究过的。还有一些我听说过的,但我认为没有被广泛使用。 Mate和Swiz在最近的360 | Flex会议上都有介绍,并有可用的视频(伙伴们有关于如何看他们的指示


I'm currently using and enjoying using the Flex MVC framework PureMVC. I have heard some good things about Cairngorm, which is supported by Adobe and has first-to-market momentum. And there is a new player called Mate, which has a good deal of buzz.

Has anyone tried two or three of these frameworks and formed an opinion?

Thanks!

解决方案

Mate is my pick. The first and foremost reason is that it is completely unobtrusive. My application code has no dependencies on the framework, it is highly decoupled, reusable and testable.

One of the nicest features of Mate is the declarative configuration, essentially you wire up your application in using tags in what is called an event map -- basically a list of events that your application generates, and what actions to take when they occur. The event map gives a good overview of what your application does. Mate uses Flex' own event mechanism, it does not invent its own like most other frameworks. You can dispatch an event from anywhere in the view hierarchy and have it bubble up to the framework automatically, instead of having to have a direct line, like Cairngorms CairngormEventDispatcher or PureMVC's notification system.

Mate also uses a form of dependency injection (leveraging bindings) that makes it possible to connect your models to your views without either one knowing about the other. This is probably the most powerful feature of the framework.

In my view none of the other Flex application frameworks come anywhere near Mate. However, these are the contenders and why I consider them to be less useful:

PureMVC actively denies you many of the benefits of Flex (for example bindings and event bubbling) in order for the framework to be portable -- a doubious goal in my view. It is also over-engineered, and as invasive as they come. Every single part of your application depends on the framework. However, PureMVC isn't terrible, just not a very good fit for Flex. An alternative is FlexMVCS, an effort to make PureMVC more suitable for Flex (unfortunately there's no documentation yet, just source).

Cairngorm is a bundle of anti-patterns that lead to applications that are tightly coupled to global variables. Nuff said (but if you're interested, here are some more of my thoughts, and here too).

Swiz is a framework inspired by the Spring framework for Java and Cairngorm (trying to make up for the worst parts of the latter). It provides a dependency injection container and uses metadata to enable auto-wiring of dependencies. It is interesting, but a little bizzare in that goes to such lengths to avoid the global variables of Cairngorm by using dependency injection but then uses a global variable for central event dispatching.

Those are the ones I've tried or researched. There are a few others that I've heard about, but none that I think are widely used. Mate and Swiz were both presented at the recent 360|Flex conference, and there are videos available (the Mate folks have instructions on how to watch them)

这篇关于Flex MVC框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆