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: Submodules in a Core?  (Read 5409 times)
emurphy
Jr. Member
**
Posts: 19


View Profile Email
« on: April 28, 2010, 09:13:29 »

Scenario: I am working on a system that is going to be used to integrate different systems into one. It basically has three levels.

[Tier #1] This part is kind of "like" a portal environment like JBoss or Sharepoint. It only acts as a frame upon which to hang other applications. It provides authentication for and navigation within applications that are plugged into it.

[Tier #2] This is basically a set of related modules. Depending on a user's permissions they may or may not have access to all of the modules in this set. But they are all tightly related and use the same classes. Likewise, each user may or may not have access to each set of modules as a whole. In fact, depending on the client, the entire set of modules may not be present on the server. A set of modules would not directly relate to a portal in a portal environment but could include multiple tabs.

[Tier #3] This is each module inside a set of modules. To keep users from loading apps that they wont use or don't even have permission to I made these modules.

So I am using MultiCore and it made sense to make each set in Tier #2 a core to keep all the related classes together. The way Tier #1 handles navigation is that a user should be allowed to switch from any Tier #3 module to another, even if it is in a different set (this makes sense in the application). The question is how to I initialize the Facade for that Core and how do I alert it to which module to default to. Here are the two solutions I have developed:

[Solutions]
1. Have each module in the core initialize the facade and the facade handles each of their start up commands. There is no main application for each core.
2. Have a main application for the core that is capable of loading each module in it. Inform the main application which module to start with.

So I implemented Solution #1 and it works great. But here is what I was wondering:

[Questions]
1. In MultiCore does module = core? Is it bad design to have a module that is not a core? I'm kind of unclear as to what a "core" is. Is it an application? Is it a piece of an application, and if so, is it expected to have a lot of communication with other cores or be fairly independent?
2. Is my implementation abusing MultiCore because there is no main application for each core in Tier #2?
3. If I went with Solution #2, how would I tell the core what module to load up? (is url params the only way)
4. What is in a module? If I have multiple modules that use the same proxie does each of their SWF files contain that proxy? Can/How do you specify what classes are associated with a particular module?

In the end this might just be a paradigm shift on how I handle navigation, but I still need to know more about MultiCore. I know an initial reaction might be "well, if these are different applications then treat them like they are". And I might go that rout, but this system needs to be more integrated than a standard OS or portal environment. Thus the fuzzy distinctions. And I won't have time for a while to remake Tier #1 to be like that anyways.

So...thoughts?
Logged
emurphy
Jr. Member
**
Posts: 19


View Profile Email
« Reply #1 on: April 28, 2010, 11:17:22 »

So I'm also interested in best practices in project structure and inter core/module communication if anyone has any tips.

As far as communication goes, I'll only ever (as far as I know now) have to pass the userVO down from Tier #1 to Tier #3 but there is never Tier #2 to Tier #2 communication. What is the best method for that?

As far as project structure goes I was reading on this post and was wanting some clarification: http://forums.puremvc.org/index.php?topic=856.0

In reality you usually have several projects.

 * One project for your main app,
 * At least one for your modules (if not several that group modules, or even one per module).
 * One or more library projects where you put classes that you share between the other projects so that they don't depend on each other or duplicate classes.

Compile your modules and libraries to make all their dependencies external, so that PureMVC, Pipes, Flex and any other dependencies are expected to be present in the main app, and aren't being compiled into your module.

Compile your main application to include these libraries. This may make the main app a little larger but the modules will be small and efficient.

1. So would I have the libraries in the main application and reference it in the sub applications (other projects)? Can you just reference a library and not have it in the build path? Or would I have a seperate project for the library rather than being in the main app?

2. So when do you keep different cores in a core folder in the main project and when do you break them out?

Going back to #4 in my previous post, I see how having modules in separate applications identifies them with their classes. Is there a way to do this if it is all in one application together?

-erik
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: April 29, 2010, 09:45:13 »

To start, you are are describing Imajn, which will be in open beta soon (http://imajn.com).

1. In MultiCore does module = core? Is it bad design to have a module that is not a core? I'm kind of unclear as to what a "core" is. Is it an application? Is it a piece of an application, and if so, is it expected to have a lot of communication with other cores or be fairly independent?
A core is the main application that loads the modules as well as the modules themselves. This is why we don't just say module; the main app is a core as well. As for what each module does and what its communication patterns and protocols are is up to you. (Imajn provides a container and defines several types of cores with different purposes).

2. Is my implementation abusing MultiCore because there is no main application for each core in Tier #2?

It's like Legos - there is no wrong way to put them together.

3. If I went with Solution #2, how would I tell the core what module to load up? (is url params the only way)
All up to you. You might use a Mediator to load and cache these Modules. They are typically components of the view. (Imajn provides this container and loading mechanism, reducing your work to defining a loaded xml configuration.

4. What is in a module? If I have multiple modules that use the same proxie does each of their SWF files contain that proxy? Can/How do you specify what classes are associated with a particular module?
Best not to pass around proxies, but if you must, be sure they are defined in a common package for reuse and don't make one module depend on another in order to reach that class.

-=Cliff>



-=Cliff>
Logged
emurphy
Jr. Member
**
Posts: 19


View Profile Email
« Reply #3 on: May 05, 2010, 09:05:07 »

So, I've been trying to break my project down into multiple projects. So far I have one for the core, one for the library, and one for a group of modules, with more to come when I write the other modules.

I keep getting a "Type Coercion failed: cannot convert XXXXX to Application" when I try and load one of the groups of modules. I realize it is because what used to be a module should now be an application but isn't. How should these "groups of modules" be put in a project? If it is a standard flex project then it needs an application doesn't it? Or did you mean i should make a library project with it?

My ideal situation is that the shell can actually load stand alone applications into it like it can with modules. Is this possible? If so, can I talk to it with pipes? Also, if that app uses the same RSL as the main app, is there a way it can reference the same RSLs on the server when it deploys without being in the same folder?
Logged
emurphy
Jr. Member
**
Posts: 19


View Profile Email
« Reply #4 on: May 05, 2010, 12:40:25 »

Ok, I figured most of this out using SWFLoader. Got pipes working too after making a PipeAwareApp class and extending it on my sub-apps. Last thing to figure out is how to get the sub-app and main app to use the same RSLs. Bet that would speed up load time. Any ideas?
Logged
Pages: [1]
Print