As an application’s complexity increases, the ease of maintenance decreases. Heck, sometimes it gets harder to even extend an application with new functionality. I’ve been working on a Flex project in my free time for the last six months or so. It’s been getting pretty unwieldy lately, and I’ve had to juggle a few too many ugly details just to modify certain interactions. After a particularly frustrating night, I decided that I should finally take a break from my coding and check out Cairngorm.
For my first flying leap into this framework, I started by developing a simple search application based on the Yahoo! API Libraries for ActionScript 3. It displays web or image results in a list and allows you to move back or forward between pages. Nothing too complicated. I wanted to start with something a bit more complex than this Hello World example (written by Laura Arguello at ASFusion), but I needed to keep it simple enough that most of my focus would be on learning Cairngorm rather than designing the interface.
I had some trouble finding simple examples of Cairngorm out in the wild, and I found it a bit frustrating. If you’re new to Cairngorm, and you want to learn more, please right-click on the app to view the source code. I encourage you to focus on the MVC structure of the classes. However, please note that I didn’t spend a lot of time cleaning up the code for the user interface. In particular, there’s a messy item renderer on the search results list that I should have made into a proper class, and I’m sure I decided to skip a few other best practices. It should be useful enough, though.
Well, MVC is not a simple pattern, it took me a while to understand as well. ActionScript Cookbook would be a good place to understand the pattern, which would lend you a hand on understanding Cairngorm.
Jesse Warden’s Amazon example for Cairngorm 2.2 is a good resource. Check it out for a cleaner implementation than mine.
Pingback: Code Sweat Blog » Blog Archive » Some Flex 2 Related Links (pt. one)
check me if im wrong but im looking for example with
class ModelLocator:IModelLocator;
any links?
mzx, using the IModelLocator interface shouldn’t be any different than using the old-style ModelLocator interface that I was using in this example. If I remember correctly, when IModelLocator was introduced, I only had to change the name and everything else worked fine. The source code for my WordWeb app used IModelLocator if you really need an example.
could not found the yahoo api classes..
please give another link to download them…
rconceiver, the link to the Yahoo! Astra Web APIs has been fixed.
thanks for that…
example is really kool..
It has cleared my vision for Cairngorm..
hi.. i need to retrieve all the table values from the database by flex+cairngorm using php+mysql.. need sample code.. help me.. please.. thanks in advance..