Flex MVC 框架 [英] Flex MVC Frameworks

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

问题描述

我目前正在使用并喜欢使用 Flex MVC 框架 PureMVC.我听说了一些关于 Cairngorm 的好消息,它得到了 Adob​​e 的支持,并且具有抢先上市的势头.还有一个叫 Mate 的新玩家,它很受欢迎.

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?

谢谢!

推荐答案

Mate 是我的选择.第一个也是最重要的原因是它完全不引人注目.我的应用程序代码不依赖于框架,它是高度解耦、可重用和可测试的.

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.

Mate 最好的功能之一是声明式配置,本质上您可以在所谓的事件映射中使用标签来连接您的应用程序——基本上是您的应用程序生成的事件列表,以及当它们发生时要采取的操作发生.事件地图很好地概述了您的应用程序的功能.Mate 使用 Flex 自己的事件机制,它不像大多数其他框架那样发明自己的事件机制.您可以从视图层次结构中的任何地方分派事件,并让它自动冒泡到框架,而不必像 Cairngorms CairngormEventDispatcher 或 PureMVC 的通知系统那样有一条直线.

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 还使用了一种依赖注入(利用绑定)的形式,可以将您的模型连接到您的视图,而无需任何一方了解对方.这可能是该框架最强大的功能.

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.

在我看来,其他 Flex 应用程序框架都无法与 Mate 相提并论.但是,这些是竞争者,以及为什么我认为它们不太有用:

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 主动否定了 Flex 的许多好处(例如绑定和事件冒泡)——在我看来这是一个双重目标.它也被过度设计,并且像它们一样具有侵入性.应用程序的每个部分都依赖于框架.然而,PureMVC 并不可怕,只是不太适合 Flex.另一种选择是 FlexMVCS,努力使 PureMVC 更适合 Flex(不幸的是,目前还没有文档,只是来源).

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 是一组反模式,导致应用程序与全局变量紧密耦合.Nuff 说(但如果你有兴趣,这里是我的更多想法,以及 这里也是).

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 是受 Java 和 Cairngorm 的 Spring 框架启发的框架(试图弥补对于后者最糟糕的部分).它提供了一个依赖注入容器并使用元数据来启用依赖项的自动连接.这很有趣,但有点奇怪的是,通过使用依赖注入来避免 Cairngorm 的全局变量,然后使用全局变量进行中央事件调度.

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.

那些是我尝试过或研究过的.还有一些我听说过的,但我认为没有一个被广泛使用.Mate 和 Swiz 都出席了最近的 360|Flex 会议,并提供了视频(the伙伴们有关于如何观看他们的说明)

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天全站免登陆