Gaia + PureMVC: Part 1

September 15th, 2008 by Steven Sacks

I've heard from various developers who have been mixing Gaia and PureMVC together with a lot of success. Gaia's flexibility is naturally suited to work well with other frameworks like PureMVC, and its Event Hijacking engine makes integration with PureMVC a snap.

The first example comes from a developer who posted his experience mixing the two frameworks on the Gaia forums explaining how he did it, what he learned, and the benefits of mixing these two powerful frameworks.

Posted in Actionscript, Flash, Gaia, PureMVC

10 Responses

  1. Glidias

    I've delete the old post and updated it taking into account some of PureMVC's best practices.

    http://www.gaiaflashframework.com/index.php/topic,914.msg3937.html

  2. Glidias

    Also, I wouldn't exactly say it's been done by a lot of developers. I'm just 1 sole developer that just tried mixing the 2.

    Well, Gaia, being a front-end framework definitely makes integrating with a backend very easy, especially since PureMVC is a very non-obstrusive backend to begin with.

    The thing is, when combining 2 frameworks, you've got A lot of options (and power) to go with it and it can get messy. With great power, comes great responsibility.

    I wouldn't say event hijacking makes integration with PureMVC "better". It just provides more options. For eg. You can conveniently let the Gaia command run first, than run the hijack which also executes the PureMVC command with callback notification. Or, you can run the PureMVC command first, then run the Gaia command once validated, keeping Gaia restricted purely on the front-end view.

    The conflict comes because Gaia integrates both view and logic together. PureMVC doesn't.

    When it comes to hijacking under Gaia, PureMVC's Mediators can't receive hijacks directly (unless you use my prescibed hackish Gaia+PureMVC fusion page). So, you'd have to dispatch another event during hijacks for the Mediator to capture it, which is very inconvenient. Thus, i've resolved to conclude that such event hijacks under Gaia should not handle application logic at all in traditional PureMVC context. Outside of that, well, PureMVC can run and notify Gaia as he wishes. So far, I find that the fusion page, though hackish, does come in useful sometimes despite contradicting best MVC practice of seperating view from application logic. It's like a compromise to achieve more functionality.

    So, for PureMVC users that wish to treat Gaia purely on the front-end, than you'd still have to code in various commands before notifying (probably the IndexMediator for IndexPage) to redirect the page. Just that if you choose to let Gaia handle some application logic as well, that might rub on PureMVC's feathers.

    Sigh, sounds like an uneasy marriage. But no doubt, combining both frameworks is very powerful indeed.

  3. Steven Sacks

    I've been speaking with other developers that are using Gaia + PureMVC. One of them is going to post an article on his blog about it sometime soon. His approach is different than yours, and I'm sure there will be much to learn from both.

  4. Chris Farrell

    Anything new on this front? I have used Gaia for several projects and am very interested in learning how to implement with MVC.

  5. Steven Sacks

    It's coming soon. The dev's been slammed and also got sick so he's been down for the count for about a week now. Patience… :)

  6. Tec

    I would also love to hear about the other puremvc / Gaia implementation as I would love to use them for future projects.

  7. wanbli

    any news about the integration of pureMVC and Gaia? I'm using pureMVC and I'd like to add the Gaia power to the next project.

    thanks for any news

  8. John Gardiner

    Absolutely… any news/exammples relating to this subject would be much appreciated.

    Many thanks and keep up the great work.

  9. Rapid Prototyping in Flash: Having cake and eating it: Part 1 - Volume Media blog

    [...] I'm not alone on this thinking about leveraging both frameworks: http://www.stevensacks.net/2008/09/15/gaia-puremvc-part-1/ If I get anywhere myself I'll let you know. Part 2 in about 6 months, [...]

  10. Chuck

    Hi Steve,

    Any update on the other developers who have integrated Gaia and PureMVC? I really want to impliment (at least) part of PureMVC into Gaia (Notification and View Mediators) for the next large project I am working on.

    Thanks!

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

About Steven Sacks

I am a professional Flash developer with over 13 years of programming experience. I have consulted for high-profile agencies and companies in San Francisco, Los Angeles, Atlanta and New York, and developed numerous award-winning websites and rich internet applications for clients including Adobe, Fox Sports, FX Networks, Anheuser-Busch, GE, DirecTV, ESPN, The Weather Channel, Home Depot, and Coca-Cola.

I am the author of the open-source Gaia Framework for Adobe Flash, which dramatically reduces development time and makes developing Flash sites much easier.