Flex: Cairngorm first impressions
First attempt at refactoring the recorder app to Cairngorm today; after trying and struggling slightly to get going with the PureMVC version (mainly because I couldn’t find a ‘getting started’ guide that worked for me and the official courseware is a closed beta) I decided to give Cairngorm a go.
Using Rob’s Simple Cairmgorm Application guide got me as far as having a skeleton framework, then I spent some time watching these excellent video tutorials by David Tucker. After modifying my existing classes and components to fit the framework eventually I got something working.
At some point I underwent one of those defining moments when something clicked in my head and now I can clearly see why this MVC stuff is A Good Thing. I now have much clearer separation of my data/value objects from my views, and can let the controllers handle events and commands. This also helped me rethink and rationalise the application design; starting with my basic views as MXML components and a simple ModelLocator, I could then define what events would trigger a view or state change, then register all those events and their Commands using the AppController. For me it was a big shift in approach and understanding.
This application doesn’t use VOs very much, but it has a lot of asynchronous states and timer events to manage, so it will be interesting to see what I end up with.