Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Shell Global Content Sharing in a Multi Core/Pipes application  (Read 7377 times)
polykrom
Jr. Member
**
Posts: 18

 - polykrom@flashcodeurs.com
View Profile WWW Email
« on: August 16, 2009, 02:38:43 »

Hi,

As i said in a previous post, I've successfully integrate Pipes in my PureMvc Multicore application.

In my Startup shell,i get Config and Content of my application, I use StartupManager to load 2 XML files (Config.xml,Content.xml), these xml are parsed and put in 2 values objects. At this point, no problem.
The two vo are accessible by my shell main container, I then load different cores modules that have their own facade and so on... but these modules need the content too...and i've also need to update shell vo from my modules.
I've read some posts here and best practice seems to not considere the Shell to be a "grand station central".. and it makes sense..
Actually when i load a module and check that this module is initialized, i send a notification from the shell to module pipe with the content vo...
Is it the best way to get and post global vo between Shell and Module or have i to create a centralize module to keep all (It would be the same issue that the shell solution).

Thanks for your advices !

:::Poly:::

Logged
polykrom
Jr. Member
**
Posts: 18

 - polykrom@flashcodeurs.com
View Profile WWW Email
« Reply #1 on: August 16, 2009, 03:02:01 »

I've just read that in other posts :

Just create a new Flex Library project to put the shared classes in.

At a minimum, you'd have three projects:

1) Your main app project,
2) Your module project
3) Your library project.

You'll make both your app project and your module project include the library project in their build paths.

-=Cliff>

The Modularity demo has a lot of ground to cover, and the primary focus of it is the communications by interface between the shell and the modules.

In a real project you can separate out your modules into separate projects, create a shared 'API' project that has just what needs to be shared between the modules and the shell. Then the client builds in the API library and loads the modules. The modules should be compiled with the API being 'external', not 'merged into code'. The main app merges the API into its code and provides it to loaded modules, so they don't have to be compiled with it.

-=Cliff>

Have i to put my common Vo, shared components and so on in a library ? Just have to test it... because for the moment my Modules are larger than my main Shell (It should be the opposite)

Also, when Cliff say "The modules should be compiled with the API being 'external'", have i to create a Flex Application for each module ?

thanks

:::Poly:::
« Last Edit: August 16, 2009, 04:14:14 by polykrom » Logged
Tekool
Sr. Member
****
Posts: 192


View Profile WWW Email
« Reply #2 on: August 16, 2009, 03:53:16 »

>Just have to test it... because for the moment my Modules are larger than
>my main Shell (It should be the opposite)

No you probably already have a good design here. In a real app the Shell must be smallest than any module it loads.

Shell must only grow in size when you are using Flex Builder to optimize module code. Flex Builder optimize module sizes by putting all modules common code in the Shell. So the less logic you have in the Shell, the better it is in my opinion.

>Have i to put my common Vo, shared components and so on in a library ?
You're right, but be careful not to use to many common VO's if you send it through Pipes, they can contains unwanted references and create some garbage collection problems.

Something else related to your first message, note that you better have to use specific configuration for each module when possible. I consider that it may be possible to run any module alone, without the core at anytime as much as possible to guarantee a good implementation.
Logged
polykrom
Jr. Member
**
Posts: 18

 - polykrom@flashcodeurs.com
View Profile WWW Email
« Reply #3 on: August 16, 2009, 04:13:26 »

I consider that it may be possible to run any module alone, without the core at anytime as much as possible to guarantee a good implementation.

Thanks Tek.. i'm on the right way so...

but, when you say that each module may run alone, in my case, it's not possible cause i get content and relation between shell and modules with pipe... so when i launch my module .swf, it doesn't display anything..

And following Cliff advice... Have i to put all application components in an external library ? I don't understand what Cliff said about not Merging library in Module (Have i to create Application for each modules with same external lib not merged into code and Shell application with the module libraries merge into code ??)

regards

:::Poly:::
« Last Edit: August 16, 2009, 04:15:23 by polykrom » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #4 on: August 16, 2009, 05:57:03 »

In Flex Builder, when building your module, in the properties page for included libraries, select 'external' instead of the default 'merged into code. Why? Think about it. If you have two modules and the shell, and they will all use the same VO, then if you compile them with the 'merged into code' option, you'll be loading the same class three times by the time the third module is loaded. Generally not desirable.

And it is not always true that the shell should be the smallest and the modules larger, in fact it may often be the other way around, since the shell often includes all the shared stuff *including* Flex, PureMVC and Pipes.

-=Cliff>
Logged
polykrom
Jr. Member
**
Posts: 18

 - polykrom@flashcodeurs.com
View Profile WWW Email
« Reply #5 on: August 16, 2009, 05:58:09 »

Ok, i finally found the solution myself...

I've created a common library with all my common classes, assets and so on...(also all PureMvc Framework and Utilities Classes)
I've added it in my main application Library as RSL, so i now have a new .swf library that is shared between shell and all my modules.
The weight of each module is now divided at least by 2 !

Wooow... so cool !

thanks ;)

:::Poly:::
Logged
polykrom
Jr. Member
**
Posts: 18

 - polykrom@flashcodeurs.com
View Profile WWW Email
« Reply #6 on: August 16, 2009, 06:01:28 »

In Flex Builder, when building your module, in the properties page for included libraries, select 'external' instead of the default 'merged into code. Why? Think about it. If you have two modules and the shell, and they will all use the same VO, then if you compile them with the 'merged into code' option, you'll be loading the same class three times by the time the third module is loaded. Generally not desirable.

And it is not always true that the shell should be the smallest and the modules larger, in fact it may often be the other way around, since the shell often includes all the shared stuff *including* Flex, PureMVC and Pipes.

-=Cliff>

Yess Cliff, i was just answered when you post :)

I've understand the process now.. and it's true that my modules are not smaller than the shell... Have to finalize some piece of work to see...

Anyway, thx a lot to Tek and Cliff

chuss

:::Poly:::
Logged
Tekool
Sr. Member
****
Posts: 192


View Profile WWW Email
« Reply #7 on: August 16, 2009, 06:48:42 »

And it is not always true that the shell should be the smallest and the modules larger, in fact it may often be the other way around, since the shell often includes all the shared stuff *including* Flex, PureMVC and Pipes.

Of course, I explained this in my answer in the next paragraph. ;) I was talking about the logic it may contains. In my opinion shell must as possible only contains the logic needed to load, unload modules and setup,tear down pipes.

: polykrom
when you say that each module may run alone, in my case, it's not possible cause i get content and relation between shell and modules with pipe... so when i launch my module .swf, it doesn't display anything..
I mean that it may compile without any dependencies to shell and must be able to launch without without any runtime error. Of course, it most cases it will not do anything without Pipes.
« Last Edit: August 16, 2009, 06:53:17 by Tek » Logged
polykrom
Jr. Member
**
Posts: 18

 - polykrom@flashcodeurs.com
View Profile WWW Email
« Reply #8 on: August 16, 2009, 10:04:04 »

Just to remember that Flex Framework can also be implemented in RSL, so it decrease also the size of the application itself and modules...

This link is very usefull : http://livedocs.adobe.com/flex/3/html/help.html?content=projects_7.html

my two cents

:::Poly:::
« Last Edit: August 16, 2009, 09:38:07 by polykrom » Logged
Pages: [1]
Print