组织 Flex 应用程序以提高编译性能的最佳方式?
我正准备重组&重构 Flash Builder 应用程序。重组的目标是 1.) 尽可能快地保持我正在处理的项目部分的编译时间,2.) 将不相关的部分分开以便代码重用。如果需要权衡的话,目标#1 胜过目标#2。
目前,该应用程序在一个项目中拥有资产,在另一个项目中拥有核心功能 AS3,在链接到其他两个项目的第三个项目中拥有 MXML。
将资源/代码移至 SWC 库有助于编译时间吗?将资产编译为 swf 并将其嵌入到主应用程序中怎么样?还有其他技术吗?
I'm preparing to reorganize & refactory a Flash Builder application. The goals of the reorg are 1.) keep compile times for the part of the project I'm working on as fast as possible, 2.) keep the unrelated parts separate for code reuse. Goal #1 trumps goal #2 if there's a trade-off.
Currently, the app has assets in one project, core functionality AS3 in another project, and the MXML in a third project that links to the other two.
Would moving resources/code into swc libraries help compile time? What about compiling assets into an swf and embedding that into the main application? Any other techniques?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 Maxim 所描述的,模块绝对是解决问题的方法。除了他的建议(这些建议都很可靠)之外,这里还有一些其他提示:
首先按业务功能构建包,然后按 MVC 角色构建包,
例如:不要使用
com.myapp.model.userconfig.UserOptions
,而是使用com.myapp.userconfig.model.UserOptions
。强制要求包只能引用其同级包或com.myapp.core.*
。这样,每个包都是一个自包含模块,它只引用自身或核心库。
Modules are definitely the way to go here, as Maxim has described. Further to his advice, which is all solid, here's some other tips:
Structure your packages by business function first, MVC role second,
Eg: Rather than
com.myapp.model.userconfig.UserOptions
, usecom.myapp.userconfig.model.UserOptions
. Enforce that packages can only reference their siblings, orcom.myapp.core.*
.This way, each package is a self contained module, which only references itself, or the core library.
我们遇到了同样的问题,应用程序编译时间超过 1 分钟。
这是我们的解决方案:
Core.resourceManager:IResourceManager
、Core.stringManager:IStringManager
等。Core.someProp提供实现
。这可以通过一些隐藏方法(例如 Core.setImpelentation())来完成。结果令人难以置信 - 您的应用程序变得低耦合,开放/编译时间减少,API 变得更加清晰。利润!
We had the same problem, application compile time was more than 1 minute.
Here is our solution:
Core.resourceManager:IResourceManager
,Core.stringManager:IStringManager
, etc.Core.someProp
. This can be done via some hidden method likeCore.setImpelentation()
.The result is incredible - you application becomes low-coupled, open/compile time decreases, APIs become more clear. Profit!