Skip to main content
March 24, 2010
Question

ModelLocator & Modules

  • March 24, 2010
  • 1 reply
  • 1470 views

I am building a large scale RIA application using Flash Builder 4.  At this point, I have the application separated into 10 modules (there will continue to be more added).  The main module holds navigation and a container to display the other modules.  Each module has it's own data model.  Cairngorm best practices suggest that I should define a reference to each data model in the main ModelLocator.  If I define a reference to each module's data model in the main module's ModelLocator, the compiler would compile each of those data model classes, as well as any classes that its properties are typed as (mainly VO/DTOs), into the main module.  While it is expected that the compiler work this way, it is not ideal.  I'd like each module to be as small and self-contained as possible, but this best practice method bloats the main module.  I currently do not have a reference to each data model on the ModelLocator, and it makes me feel like I am misusing ModelLocator.  Please share some thoughts on this.

This topic has been closed for replies.

1 reply

Participating Frequently
March 24, 2010

You could create multiple ModelLocators for each functional area of your application to limit dependencies. Check out our guidelines to modular development.

March 24, 2010

Thank you for the suggestion, but that is how I currently have it set up.  It works fine, I just feel uneasy about the main ModelLocator being unaware of the other data models (i.e. other ModelLocators).

Participating Frequently
March 24, 2010

Why do you feel uneasy about that? You've reduced a concrete dependency that might allow one module to be developed and tested in isolation. That's one of the most important practices in larger Flex clients and a key message of Cairngorm 3.