Skip to main content
Participating Frequently
June 2, 2010
Question

An application model in Cairngorm 3

  • June 2, 2010
  • 1 reply
  • 886 views

Hi,

I'm just looking into using Cairngorm 3 with Parsley. My application has several views, similar to the InSync modular example, but a large amount of the data needs to be shared between views.

I guess because of this, I shouldn't be using modules.

Also, where each view in the examples has its own presentation model, I guess I will need an overall application model for holding this shared data? Does this sound right?

To clarify, I will have one view which lists a company's assets.

I will have another view which shows income and expenditure.

In a third view, I will be showing graphs which shows the company's value over time, which will include data from the assets and the income data.

So, would I be correct in creating the following views:

presentation.Assets with associated presentation.AssetsPM

presentation.IncomeExpenditure with associated presentation.IncomeExpenditurePM

presentation.CompanyValue with associated presentation.CompanyValuePM

and a final

domain.CompanyData class which holds all the shared company data?

and then, within each PM, using:

[Inject]

[Bindable]

public var companyData:CompanyData;

Thanks for your help, I'm just getting my head around best practices.

This topic has been closed for replies.

1 reply

Participating Frequently
June 2, 2010

Hi Eric,

try to think about functional cohesion and create more focused objects with fewer responsiblities. PMs often tend to attract too many responsiblities, it's then up to the developer to extract into more functionally cohesive objects. You can see some of those in Insync, i.e. the Contacts domain. Instead of separating the "data" (CompanyData), try to keep it closer to the related behaviour and separate it by architectual layers with thinking about the right amount (not too much and not too little) of loose coupling. I don't see why anything should stop you from creating a modular application that allows you to develop and test functional areas in isolation. Note that functional areas can be modules, sub applications or library projects. Even if you don't extract the code (into i.e. a module), at least try to separate it and control the dependencies.

Best,

Alex