Gaia + PureMVC: Part 1
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
September 18th, 2008 at 3:02 am
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
September 18th, 2008 at 3:58 am
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.
September 18th, 2008 at 8:51 am
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.
October 6th, 2008 at 3:37 pm
Anything new on this front? I have used Gaia for several projects and am very interested in learning how to implement with MVC.
October 6th, 2008 at 5:41 pm
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…
December 4th, 2008 at 1:29 pm
I would also love to hear about the other puremvc / Gaia implementation as I would love to use them for future projects.
December 11th, 2008 at 10:01 am
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
December 18th, 2008 at 6:18 pm
Absolutely… any news/exammples relating to this subject would be much appreciated.
Many thanks and keep up the great work.
February 27th, 2009 at 12:21 pm
[...] 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, [...]
September 11th, 2009 at 2:01 pm
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!