Flexible RIA Architecture: PureMVC and Mate

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:

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:

http://forums.puremvc.org/index.php?topic=1000.0

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:

http://shaun.boyblack.co.za/blog/2009/02/24/pijinnet-v3-progress-update-24-feb-2009/
http://shaun.boyblack.co.za/blog/2009/03/13/as3-dependency-injection-and-autowire/

MAJOR UPDATE: RobotLegs 0.1, with demo Flex app, has been released. More info here:

http://shaun.boyblack.co.za/blog/2009/04/16/robotlegs-an-as3-mvcs-framework-for-flash-and-flex-applications-inspired-by-puremvc/

Posted in Resources | Tagged , , , , , , | 10 Comments
  • Kyle

    looking forward to hearing how this floor crossing turns out for you…….keep us updated mate! [sorry]

  • Kyle

    looking forward to hearing how this floor crossing turns out for you…….keep us updated mate! [sorry]

  • http://puremvc.org/ Cliff Hall

    Hi Shaun,

    I read your post and the ‘document based’ link, but I’m still not sure I understand your problem. It would be nice if you could elucidate a bit as to where the apparent failing lies.

    IF there is a major class of applications that PureMVC is not ‘a good fit for’ as you’ve decided here, it’d be nice for the community to have the opportunity to address that. Often the solution is merely a well-concieved utility that augments the framework for your particular problem domain.

    -=Cliff>

  • http://puremvc.org Cliff Hall

    Hi Shaun,

    I read your post and the ‘document based’ link, but I’m still not sure I understand your problem. It would be nice if you could elucidate a bit as to where the apparent failing lies.

    IF there is a major class of applications that PureMVC is not ‘a good fit for’ as you’ve decided here, it’d be nice for the community to have the opportunity to address that. Often the solution is merely a well-concieved utility that augments the framework for your particular problem domain.

    -=Cliff>

  • http://shaun.boyblack.co.za/blog/ shaun

    Hello Cliff,

    Yes, re-reading my post it seems I didn’t really justify the “why” part.. Pretty poor form I must admit!

    I shall try formulate my thoughts a little better and write a post on the PureMVC forum.

  • http://www.boyblack.co.za shaun

    Hello Cliff,

    Yes, re-reading my post it seems I didn’t really justify the “why” part.. Pretty poor form I must admit!

    I shall try formulate my thoughts a little better and write a post on the PureMVC forum.

  • http://shaun.boyblack.co.za/blog/ shaun

    Kyle, I just got your pun! I see what you did there ;)

  • http://www.boyblack.co.za shaun

    Kyle, I just got your pun! I see what you did there ;)

  • Pingback: Pijin.net V3 Progress Update - 24 Feb 2009 « shaun smith()

  • Pingback: RobotLegs - An AS3 MVCS framework for Flash and Flex Applications inspired by PureMVC « shaun smith()