使用 Flex 模块进行开发时,是否应该将 VO 添加到库项目中?
我正在 Flex 中开发基于模块的应用程序,我正在考虑将所有值对象 (VO) 移至库项目中,我想知道是否有人认为这是一个坏主意或有任何替代建议。
当前结构: 我有一个由一个 shell 应用程序和 3 个模块组成的项目。每个模块包含大约 10 个自定义组件,这些组件在运行时动态加载。我的问题是组件A(在模块A中)需要将数据传递给组件B(在模块B中)。因此,当发生这种情况时,我将组件 A 使用的 VO 移动到公共文件夹。然后我传递 VO,并让组件 B 接收它并对其进行所需的处理。
所以我的想法是使用现有的库项目并将我所有的 VO 添加到其中。这样我就不必将 VO 从模块移动到公共文件夹,以便模块 A 和模块 B 都可以访问它。基本想法是我希望能够将任何模块从 shell 完全抽象到自己的小部件或 Air 应用程序中,而不依赖于任何其他模块。
有人认为这是不好的做法吗?如果是这样,为什么?你还有其他选择吗?
谢谢!
I'm developing a module based applications in Flex and I was thinking about moving all my Value Objects (VOs) into a library project and I was wondering if any thinks this is a bad idea or have any alternative suggestions.
Current Structure:
I have a project that consist of a shell application and 3 modules. The modules contain about 10 custom components in each that are dynamically loaded at run time. My problem is component A ( in module A) needs to pass data to component B (in module B). So when this happens I move the VO that component A was using to a common folder. I then pass the VO and have component B pick that up and do what ever it needs to do with it.
So what I was thinking was using an existing library project and adding all my VOs to it. This way I'll never have to move a VO from the module to a common folder so both module A and module B can access it. The basic idea is I want to be able to complete abstract any module from shell into its own widget or Air app with out depending on any other modules.
Does anyone think this is bad practice? If so, why? and do you have any alternatives?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的方法很有意义,并且或多或少是图书馆项目的设计目的。您可以将 SWC 直接编译到主应用程序 SWF 中,甚至可以将该库外部化为 RSL。除非您有大量 VO(数百个),否则将它们直接编译到主 SWF 中可能更有意义。
Your approach makes sense and is more or less what the library projects were designed for. You can compile the SWC directly into your main application SWF or even externalize the library as a RSL. Unless you have a lot of VO's (hundreds) it will probably make more sense to compile them directly into the main SWF.
我倾向于跳过整个 VO 系统并使用原生对象(Object)。它并不完全是自记录的,但它更方便和便携。您可以使用 JSON 库轻松序列化它。但可能根本无法帮助您解决问题。
I tend to skip the whole VO system and use native objects (Object). It's not quite as self-documenting, but it is more convenient and portable. And you can easily serialize it with the JSON library. Probably doesn't at all help you with your problem though.