组织 Flex 项目供团队使用

发布于 2024-10-16 04:21:42 字数 807 浏览 4 评论 0原文

我是 Flex/Actionscript/FlashBuilder 的新手,我不太了解所有的组织概念。我们团队的项目主要基于 ASP.NET,因此没有很多 Flex 代码。实际上并不需要组织/重用公共库。我正在添加一个相当大的组件,其中包含很多文件,并且我想开始为未来的开发人员组织它。

据我所知,.NET 有:

  • 解决方案文件:指向一堆项目文件。
  • 项目文件:包含实际代码和依赖项。
  • 命名空间:以分层方式组织代码。

在 Flex 中,我想要一个类似于以下示例的层次结构:

  • 汽车经销商
    • 业务层
      • 客户
      • 员工
    • 用户界面组件
      • 广告
      • 窗口标签
      • 汽车
    • 基础设施
      • 工资单
      • 数据库
    • SWF 项目
      • 库存查看器
      • 汽车功能查看器
      • CurrentFlyerViewer

在.NET 中,我可以有一个 InventoryViewer 项目文件和一个解决方案文件,该文件打开 InventoryViewer 项目文件及其依赖的 Infrastructure.Database 项目文件。或者,如果我也不想处理数据库项目,我可以有一个仅指向 InventoryViewer 的解决方案文件,但依赖性仍然存在。这如何转化为 Flex 代码组织?我很难区分包、项目和普通文件夹层次结构之间的区别。提前致谢。

I'm new to Flex/Actionscript/FlashBuilder, and I don't quite get all the organization concepts. Our teams project is primarily ASP.NET based, so it doesn't have a lot of Flex code. There hasn't really been a need for organization/reuse of common libraries. I'm adding a rather large component that has a lot of files, and I'd like to start keeping it organized for future developers.

As I see it, .NET has:

  • Solution File: Points to a bunch of project files.
  • Project File: Contains the actual code and dependencies.
  • Namespace: Organizes code in a hierarchical manner.

In Flex, I want a hierarchy somewhat like this example:

  • Car Dealership
    • Business Layer
      • Customer
      • Employee
    • UI Components
      • Advertisement
      • Window Tag
      • Car
    • Infrastructure
      • Payroll
      • Database
    • SWF Projects
      • InventoryViewer
      • CarFeatureViewer
      • CurrentFlyerViewer

In .NET, I could have a InventoryViewer Project file, and a Solution file that opened the InventoryViewer project file along with the Infrastructure.Database project file which it depends on. Alternatively, I could have a Solution file that just pointed to InventoryViewer if I didn't want to work on the Database project as well, but the dependency is still there. How does this translate to Flex code organization? I'm having a hard time telling the difference between packages, projects, and just a plain folder hierarchy. Thanks in advance.

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

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

发布评论

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

评论(2

三生路 2024-10-23 04:21:42

当您想要镜像 VisualStudio 的解决方案样式视图时,实现此目的的最佳方法是在“解决方案”工作区中创建多个项目

但没有直接的等效项,因此不必担心尝试以相同的方式查看层次结构。

但是,当您拥有像这样的小型工作空间时,您可以一次性构建所有项目,并将构建时间保持在最短水平。

版本控制只能在项目级别发挥作用,因此一开始可能会很痛苦,您必须单独检查每个项目,而不是能够一次性检查解决方案。

关于包、项目和普通文件夹层次结构之间的区别:

  • Project:一个包含代表项目的 Eclipse 元数据的文件夹(保存在该文件夹和父工作区文件夹中),项目可以有多个构建目标,但只能有一个使用标准的运行调试按钮一次构建,要在单个项目中构建多个目标,您必须使用Ant或一些

  • 包:与 .net 所谓的名称空间更密切相关,但是 Flex 有自己的名称空间概念,主要与 XML / MXML 相关,但这是一个相当大的主题,因此我将避免这一点。包必须与它们存储的文件夹相关,例如

.

package com.example.view {
    class SomeViewClass extends SomeFlexComponent {
    // .... etc
    }
}

该类将存储在 src/com/example/view/SomeViewClass.as 中 - 与 C# 不同,类/包名称和文件夹必须匹配,否则编译器将抛出错误。

我相当确定我没有涵盖这里的所有内容,所以如果您需要进一步说明,请告诉我。

When you want to mirror the solutions style view of VisualStudio, the best way to accomplish this is to create multiple projects into a 'solution' workspace.

There isn't a direct equivalent though, so don't worry about trying to see the hierarchy in the same way.

However, when you have a small workspace like this, you can build all projects in one pass, and keep the build times at a minimum.

Version control will only work well at the project level, so that can initially be a pain, instead of being able to checkout the solution in one go, you have to check out each project individually.

Regarding the difference between packages, projects and plain folder hierarchy:

  • Project : A folder with Eclipse metadata (held in the folder and also in the parent workspace folder) that represents a project, projects can have multiple build targets, but only one is built at a time using the standard Run or Debug buttons, to build multiple targets in a single project, you have to use Ant or some other build tool.

  • Packages : More closely related to what .net calls namespaces, however Flex has it's own concepts of namespaces, mostly relating to XML / MXML, but that's a fairly big topic so I'll avoid that. Packages must relate to the folders they are stored in, e.g.

.

package com.example.view {
    class SomeViewClass extends SomeFlexComponent {
    // .... etc
    }
}

This class would be stored in src/com/example/view/SomeViewClass.as - unlike C# class/package names and folders must match, or the compiler will throw an error.

I'm fairly sure I haven't covered everything here, so let me know if you need further clarification about any of this.

烟若柳尘 2024-10-23 04:21:42

如果您访问一些框架站点并查看示例,您可以看到它们如何构建应用程序。下面是在 Mate 的 Flex 框架站点上找到的一个程序的源代码视图。您可以下载源代码并在 FlashBuilder 中打开它以获得更好的体验。

http://mate.asfusion.com/assets/content/examples/intranet/ srcview/

就我个人而言,当我布局 Flex 应用程序目录结构时,我会根据视图将其分解为“翅膀”。当然,共享的东西有一个共享目录。因此,对于您的示例,我会这样布局。

汽车经销商
*库存
--views(与库存相关的视图)
--components(与库存相关的组件)
--事件
--演讲者
--services

这样做的优点是它允许模块化,因此您不必立即加载整个应用程序。

If you vist some of the framework sites, and view the examples, you can see how they structure their applications. Here is the source view for a program found on the Flex framework site of Mate. You can download the source and open it in FlashBuilder to get a better feel.

http://mate.asfusion.com/assets/content/examples/intranet/srcview/

Personally, when I layout a Flex app directory structure, I break it up into "wings" based on views. Of course there is a shared directory for things that are shared. So for your example I would lay it out like this.

Car Dealership
*inventory
--views (views pertaining to the inventory )
--components (components pertaining to the inventory )
--events
--presenters
--services

The advantage of this is that it allows for modularity, so you don't have to load the entire application at once.

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