本帖最后由 thierryxing 于 2009-7-29 03:37 编辑
原文:
Mate is a tag-based, event-driven framework. Tag based means that it is implemented entirely in MXML. It is event driven in that the central focus of the framework is to make it easier to define who responds to events.
There are only two basic requirements for creating a project usingMate: You must have one or more events, and you must have an MXML filecalled an event map—that is, a simple MXML file included in the mainapplication file. It defines the events you want to listento and how they should be handled. You must have at least one of thesefiles, but you can use multiple event maps, if necessary.
Mate also implements the idea of dependency injection—sometimesreferred to as the Hollywood principle, or "don't call us, we'll callyou." Objects are constructed in such a way that the data they requireis provided to them or injected into the class. In other words, theclasses don't call out to get data ("don't call us") but rather arepassed the data they need ("we'll call you").
Strengths
Mate promotes loose coupling through its use of dependency injection.Because components do not rely on global singletons, they are freer toacts as independent agents. Mate does not keep you from using Flex'sbuilt-in event model, nor does it limit you to a single response foreach event as Cairngormdoes. Mate's MXML files and tags are straightforward and easy to use,and if you get stuck, the documentation is good and there are plenty ofcode examples on the site.
Download compiled library (SWC) version 0.7.3 - Flex 3
译文(译者:thierryxing):
Mate是一款基于标签,并由事件驱动的框架。基于标签意味着它继承了整个MXML。该框架的核心是事件驱动,它简化对谁来响应事件的定义。
使用Mate来创建一个项目只有两个基本的需求:你必须拥有一个或多个事件,同时你还必须有一个MXML文件来来调用一个事件映射——那就是,将一个简单的MXML文件包含在主应用文件中。它定义了你想要监听的事件和如何处理这些事件。你必须至少有一个这样的文件,不过如果必要的话,你也可以使用多个事件映射。Mate同样实现了依赖注入的思想--有时借鉴了好莱坞准则“不要打电话给我们,我们会打电话给你。对象由这种方式构造:提供它们所需要的数据或注入到类里。换句说,这些类并不从外面获取数据(“别打电话给我”),而是根据需要接收传入的数据(“我们会打电话给你”)。
增强
Mate通过使用依赖注入而提升了松耦合。因为组件不用依赖于全局单例,所以它们可以自由地担当独立角色。Mate既不会阻止你使用Flex的内置事件模型,也不会限制你对每一个事件进行类似于Cairngorm的单独响应。Mate的MXML文件和标签简单易用,如果你遇到问题,Mate的帮助文档很不错,当然你也可以通过Mate网站上众多的代码示例来解决问题。
Download compiled library (SWC) version 0.7.3 - Flex 3 |