views:

81

answers:

2

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!

A: 

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.

Glenn
You will also lose all compile-time checking by using the prototype Object.
cliff.meyers
That's of debatable benefit in terms of objects. You can always assign to variables when you pull them out of the JSON. VOs just push another layer.
Glenn
Thanks for the response, but I'm not doing any work with JSON. I'm using BLazeDS, so linking my VO to RO is automatically done for me.
Shua
A: 

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.

cliff.meyers