Cairngorm Over-Simplified

February 24th, 2008

cg_oversimplified.jpg

I created this diagram over a year ago for a presentation I did at the Boston Flash Platform User Group‘s design patterns subgroup. Lately I’ve wanted to show it to a few people, so I might as well post it here. It’s a deliberately over-simplified snapshot of the Cairngorm framework and omits some not-so-minor details like the EventDispatcher. Evan Gifford’s CairngormDiagram is much more complete, but I find this diagram useful for explaining the big picture.

Chen Bekor performed a real service when he created a modified CairngormStore example that decoupled the application from its data services, replacing them with mock objects, back in late 2006.

This version's beauty is that it can be installed and run easily. It is extremely helpful when learning Cairngorm to have a working version that you can play with and step through in your debugger.

I've just upgraded the example for Cairngorm 2.2.1 and Flex 3. Below is a list of the changes I've made. You don't need to read these if you just want to explore and learn. Just download the .zip file, unzip, import into FlexBuilder 3, and run. If you'd like more detailed instructions Chen was kind enough to include some in a readme.txt file in the project folder.

Here's the file:

Chen Bekor's ModifiedCairngormStore_2_2_1.zip

Change Log

I'm including this list of changes a) for the record, and b) because these steps will probably also be needed for most any Cairngorm application that you're updating from 2.1 to 2.2.1.

  • I replaced the Cairngorm SWC with source code so that you can step through both the example code and the framework's code in your debugger.
  • I replaced the first three lines of com.adobe.cairngorm.samples.store.business.ServiceLocator:
CODE:
  1. Replaced code:
  2.  
  3. xmlns:mx="http://www.adobe.com/2006/mxml"
  4. xmlns:cairngorm="http://www.adobe.com/2006/cairngorm">
  5.  
  6. Replaced with:
  7.  
  8. xmlns:mx="http://www.adobe.com/2006/mxml"
  9. xmlns:business="com.adobe.cairngorm.business.*">

  • I modified the last line in the same file so that it uses the same "business" namespace.
  • I added the following folders to the project root folder:
    • [project_root]/src/
    • [project_root]/locale/en_us/
  • I moved the following files and folders from [project_root] to [project_root]/src/ as this is the standard Flex 3 source code location:
    • Main.mxml
    • cairngormstore.css
    • /assets/*
    • /com/*
    • /data/*
  • I placed this file into the [project_root]/locale/en_us/ folder I just created: CairngormMessages.properties
  • I went into Project | Properties | Flex Build Path and added "locale\{locale}" to the source path.

This leaves one warning that appears when the project is compiled. It complains that com.adobe.cairngorm.CairngormError uses ResourceBundle.getString(), "which has been deprecated". I'm inclined to let the folks at Adobe Consulting fix this one, as it's in the Cairngorm code.