Flex IoC frameworks: which?
I need some Flex framework advice; I’m about to start a couple of new AIR projects, and decided that instead of using Cairngorm again it would be a good idea to try a different framework. There’s no particular reason to move away from Cairngorm – I’ve become reasonably comfortable with how it works and what it does, and I like it, but I’d also like to explore other approaches to Flex development. Last time I looked around there were a few alternatives, but in the few months since I posted that entry a number of new frameworks have appeared, and the amount of choice has increased considerably.
At first I thought I’d go for PureMVC – it seems like a popular framework in general, but around here our Java development is based on Spring, and I’d quite like to explore the dependency injection/IoC concepts at the core of Spring in a Flex app, to learn for myself how to apply such patterns in a context I’m familar with.
As far as I can tell, there are three IoC frameworks – Prana is a lightweight IoC container for PureMVC, Mate, which looks really well-thought out, with good documentation, and finally Swiz, which also looks interesting. I’m just not sure which will help me get into IoC as quickly as possible, coming from Cairngorm. I suspect I’ll go for PureMVC with Prana, but if anyone has any advice/insight it would be useful!
14 comments by 1 or more people
[Skip to the latest comment]ekameleon
Hello :)
Try my opensource framework VEGAS and this extensions :
http://code.google.com/p/vegas/
To install it you can read :
http://code.google.com/p/vegas/wiki/InstallVEGASwithSVN
In VEGAS you can find the extension AndromedAS with a full MVC/IOC/... tools
Ex : http://code.google.com/p/andromed-as/wiki/TutorialsAndromedA_IOC
you can read to for the moment my french tutorials about it :
http://groups.google.com/group/vegasos/web/design-pattern-dinversion-de-contrle
The english tutorials coming soon !
VEGAS work in AS3 with Flash or Flex … but you can use it in AS2 and SSAS (Server Side ActionScript with Flash Media Server)
EKA+ :)
11 Sep 2008, 00:14
Marc Hughes
Parsley is very good.
http://www.spicefactory.org/parsley/
11 Sep 2008, 02:12
Kim Hansen
Check out Mate – it is very non-obtrusive and clean. I have experience with both Cairngorm and PureMVC, but lateley have fallen in love with Mate.
11 Sep 2008, 15:00
Tech Per
Hmm, not an easy choice to make. To me, I think none of the available frameworks are brilliant. But some are “good enough”. Currently, we have chosen to go with puremvc, but without prana. But I do not know, if it is the best.
I think, that you need to be distinct on what an MVC framework is and gives you and what an IoC container is and gives you. They are not the same.
Prana actually is born as a spring-like framework for as3. That is, as an IoC container only, that does the dependency injection for you. Later on, someone wrote some puremvc extensions for it. And in my opinion, these extensions are badly written. This is partly because puremvc doesn’t provide the neccessary hooks, to let prana do the object instantiation for you. In the end, you still end up with commands, mediators, ... they will just be PranaCommand, PranaMediator, ... with direct dependencies on prana framework as a result. Not good.
With respect to Mate, is is not an IoC container, but it does provide some dependency injection facilities for the ui of it, which is a good thing. Just yesterday, I wrote an article on good and bad things in the Mate framework which you might find useful.
With respect to puremvc, I am happy with it as “good enough” (without DI or IoC in any form), but only see it as “good enough” among the current contenders. There are so many abstractions, that hides the fact that the code is build on flex. There are so many ServiceLocator patterns. There are quite a lot of extra code to write. My Mediators, Commands and Proxies needs to inherit puremvc bases and hence are not just POJOs. And I could go on. Nevertheless, it works for us, and provides good MVC places to put the code. It keeps the code structured and untangles previous spaghetti.
As I said. Not an easy choice :-) Today, I think I would either (a) go with Mate or, (b) write my own (as if any client would care to finance that).
11 Sep 2008, 15:39
Steven Carpenter
Thanks all for your helpful advice – I’ll certainly take a look at all the frameworks mentioned.
11 Sep 2008, 20:10
MikeH
Flicc is a new IOC container for Flex, but does not have the PureMVC / Cairngorm integration of Prana.
12 Sep 2008, 11:26
*sigh*
Flex/AS 3 has no true reflection…so there is no real IoC
12 Sep 2008, 17:44
borf
Prana is pretty good. we are using it now.
You need to separate the differences between MVC frameworks and an IoC container before you make any decisions. As other posters have stated, you have things intermingled.
Also for whatever IoC you end up choosing. I recommend creating a generic “container” interface with a getObject() like method. Then either subclass your chosen IoC container or write a wrapper class for it, then write your code against the generic simple “container” interface. Why? There is a TON of maturity that is going to go on in AS3/Flex in the IoC arena. Once the big players are sorted out, you want to be able to swap our your IoC container easily.
26 Sep 2008, 23:41
borf
Also just a followup, you may be better served by choosing an IoC framework project that ONLY does IoC, and likewise an MVC framework that ONLY does MVC. Reason being is that from experience in the Java word, projects that focus on one specialized area are often better and more mature than those that try to cover the whole gamit (i.e. mvc + ioc all bundled together)
26 Sep 2008, 23:48
Tech Per
Steven, I just wanted to let you know, that I just did a write-up of my negative experienced with puremvc – If you haven’t already chosen a framework by now :-)
05 Oct 2008, 21:17
Steven Carpenter
Brilliant, thanks Per – I was just about to start with a PureMVC/Prana project, so I’ll give it a read!
06 Oct 2008, 09:10
Hem Talreja
Steven,
I have written a flex app using Swiz, it was real easy and quite fun, I will be posting a revised version of that application shortly.
You can download the sample code from http://www.hemtalreja.com/?p=258
Technologies used:
ColdFusion using ColdSpring (a ColdFusion port of Spring)
Flex using Swiz (a Flex port of Spring (partial))
There is another IOC framework on Adobe’s website I cannot remember the name.
Enjoy!!!
Hem
30 Dec 2008, 15:15
Amazuzu
Hi,
I’ve created yet another IoC framework called PARADE.
http://code.google.com/p/paradeframework/wiki/UsageScenario
Sure it not adhere to industry ioc standarts but truly satisfy all my ioc needs :)
Regards
01 Feb 2009, 10:11
args
I am a little confused with this. I understand what are the benefits of using MVC framework and IoC container but at the same time I feel like both of them are doing the same thing. Both help you make reusable components. For MVC framework I would go for PureMVC and for IoC I’d choose Prana. But from here raises another question. Should I use MVC framework (like PureMVC) and IoC together or would that only complicate things?
12 Feb 2009, 08:20
Add a comment
You are not allowed to comment on this entry as it has restricted commenting permissions.