AS3/PureMVC 最佳实践? 架构良好的项目的最佳代码示例?

发布于 2024-07-06 02:41:49 字数 158 浏览 7 评论 0原文

我是一名学习 PureMVC 的 AS3 新手,希望按照最佳实践编写代码,以便任何其他 AS3 开发人员都可以拿起我的代码并轻松理解我所做的事情,我很想像在 JavaScript 或 Asp.Net/C# 中那样做一些事情,但我有一种感觉,这可能不是最好的方法。

想法? 链接?

I am a AS3 novice learning PureMVC and want to write code following best practices so that any other AS3 developer can pick up my code and easily understand what I did, I am tempted to do stuff as I would in JavaScript or Asp.Net/C#, but I have a feeling that might not be the best approach.

Thoughts? Links?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

┈┾☆殇 2024-07-13 02:41:49
  1. 从我见过的 Flex 代码来看,使用反向域文件夹结构很常见。 IE:
    com/mydomain/myproject/view ...模型、业务、控制器(这将使我更容易理解您的代码)
    更多:http://blog.tsclausing.com/post/11

  2. ASDoc 是一个可以根据代码注释自动创建非常漂亮的 HTML 文档的工具:
    http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=asdoc_127_1.html

  3. 您可能超出了这一点但我使用过 Cairngorm (MVC),并且有详细记录:
    http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm

代码示例
这是 Cairngorm 商店,它是标准的 Cairngorm 示例:
http://cairngormdocs.org/blog/?p=17

  1. Using reverse domain folder structure is common from the Flex code I have seen. ie:
    com/mydomain/myproject/view ... model, business, controller (this would make it easy for me to understand your code)
    More: http://blog.tsclausing.com/post/11

  2. ASDoc is a tool that creates very pretty HTML documentation from code comments automatically:
    http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=asdoc_127_1.html

  3. You may be beyond this point but I have used Cairngorm (MVC) and it was well documented:
    http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm

Code Example
This is the Cairngorm store which is the standard Cairngorm example:
http://cairngormdocs.org/blog/?p=17

云归处 2024-07-13 02:41:49

我发现通读文档可以帮助我清楚地定义 PureMVC 的每个部分。 最重要的是,我下载了演示的源代码并将它们添加到 Flex Builder 中,这样我就可以轻松地浏览它们并了解它们是如何构建的,从而了解我应该如何构建我的项目。

您必须记住的一件事是,您可以以任何您想要的方式做事,但是为了使使用该框架有价值,您应该坚持它建议的结构和做事方式。 例如,您可以为视图提供对外观的引用,并让它从代理等获取信息。但是您应该使视图与框架分离,只让它调度事件并让中介器处理外观。

I found that reading through the docs helped me get a clear definition of each of the parts to PureMVC. On top of that I downloaded the source for the demos and added them in Flex Builder so I could look through them easily and see how they were constructed to get an idea of how I should construct my project.

One thing you have to remember is that you can do things any way you want, but to make using the framework worthwhile you should stick to the structure and way of doing things that it suggests. For example you could give your view a reference to the facade and have it get information from Proxies etc. But you should keep the view decoupled from the framework and just have it dispatch events and have a Mediator deal with the facade.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文