I’ve been using PureMVC for my Flash/Flex applications for quite a while now, and have generally found it to work quite well. Besides the obviously annoying abundance of boiler-plate code, it does a decent job of separating concerns, and has helped me to build better applications.
Lately, however, I’ve been building an application for which PureMVC has turned out to be a pretty poor fit. The term that some people have used to describe this kind of application is “Document-Based”.
A benefit of MVC is the ability to easily create multiple Views of the same Model. Document-based is roughly the opposite of that: the ability to create identical Views of different data. Think OS X Finder (or Windows Explorer if you must!): multiple windows that look and function the same but show different parts of your filesystem.
I spend a lot of my time trying to learn as much as possible about programming. This means subscribing to a huge number of feeds and bookmarking obsessively! Looking for solutions to my current problem I re-discovered Mate. I hadn’t looked too deeply into it before as I needed an ActionScript Framework that wasn’t bound to the Flex Framework (ruling out pretty much every framework except for PureMVC). This time however, I didn’t mind binding(!) myself to Flex.
Central to Mate is the concept of an Event Map. UI components dispatch events that bubble up the display list and get caught by one or more Event Maps: loosely coupled goodness. Mate also employs Dependency Injection instead of the Service/Model Locator pattern used by Cairngorm and PureMVC. And no Singletons! Suitably impressed.
I highly recommend you check out Mate, and if I were you I’d do it in this order:
- Mate Presentation by Laura Arguello: fairly long, and a bit slow, but quite fun and covers some really important concepts – not just for Mate, but application architecture in general
- Hello Mate by Neil Webb
- Mate Overview
- Mate Document-Based Example by Theo Hultberg/Iconara: lots of great info
Ok, time for me to calculate how painful it’s going to be to switch my application over to Mate.
UPDATE: I posted my thoughts (as best as I could gather them) on the PureMVC forum here:
UPDATE: I decided not to switch to Mate for my current project. I wrote a little MVC framework (much like PureMVC), that uses Dependency Injection, and switched to that instead. More here:
MAJOR UPDATE: RobotLegs 0.1, with demo Flex app, has been released. More info here: