views:

313

answers:

6

Given that Flex is still a relatively young technology, there are already a bunch of architectural frameworks available for Flex/AIR (and Flash) development, the main ones being Cairngorm and PureMVC. The amount of architectural frameworks is remarkable compared to other technologies.

I was wondering how many of you use an architectural framework for Flex development. If so, why, or why not if you don't use any?


To share my own experience and point of view: I have used Cairngorm (and ARP for Flash development) on a variety of projects and found that at times, we needed to write extra code just to fit into the framework, which obviously didn't feel right. Although I haven't used PureMVC on many occasions, I have the same gut feeling after looking at the examples applications.

Architectural frameworks equal religion in some way. Most followers are convinced that their framework is THE framework and are not open or very skeptical when it comes to using other frameworks. (I also find myself hesitant and skeptical to check out new frameworks, but that is mainly because I would rather wait until the hype is over.)

In conclusion, I'm thinking that it is better to have a sound knowledge of patterns and practices that you can apply in your application instead of choosing a framework and sticking to it. There is simply no right or wrong and I don't believe that there will ever be a framework that is considered the holy grail.

+1  A: 

First hy, grade post, I must say I use PureMVC for more than a year and I have to say I am very glad with the results. You are right it's bad to stick to a framework but you must know when to use the framework and when to not.

ghalex
+2  A: 

Flex itself is a pretty nice component framework and Flash has a very straightforward event model. These two things alone can get you very far in developing Flex apps.

I wrote two large applications with Cairngorm in the Flex 2 days and I can't recommend it. It's bloated, over-abstracted and requires far too much code to do even simple things. The fact that people have written code-generation tools for Cairngorm I think proves the point that there's just too much to it. Cairngorm is also problematic in that it relies heavily on the Singleton which is basically a nasty way to use global variables in OOP. MVC doesn't need to be that hard and at the end of the day, it's just a few patterns to help with code organization and keeping business logic out of your UI code. This can very easily be done without a framework by exercising some discipline.

What is very interesting to me is the IoC solutions starting to percolate in the community. I think the Flex framework needs to evolve so that there is an easier way for IoC/DI containers to plug into the component lifecycle. The value that these kinds of tools can deliver is enormous compared to what you could ever hope to get out an MVC framework.

cliff.meyers
+2  A: 

I used frameworks all the time in my Java days, but I've worked on a number of different Flex-based products in the past two years and there was no formal architectural "framework" for any of them - the principal engineers simply adhered diligently to good design. Flex (helped in no small part by the expressiveness of MXML) lends itself well to proper layering of an application.

With that said, I have to agree wholeheartedly with brd6644 - there have been a number of times when I've wished we had some of the capabilities that IoC/DI containers offer.

erikprice
+2  A: 

I use Mate. It is lightweight and very easy to setup and understand. Like Spring, it is non-obtrusive and is pretty well documented. If Cairngorm is a sledgehammer, then Mate is a Leatherman. It has benefit for even trivial applications, if only to eliminate a lot of the boilerplate code.

Mike Sickler
+3  A: 

I've used PureMVC on a number of projects, but also played with Swiz, Mate and MVCS quite a bit. I've studied Cairngorm, but not used it for any real-world projects.

The conclusion of your post is certainly on the mark: it is indeed "better to have a sound knowledge of patterns and practices" than simply "choosing a framework and sticking to it."

HOWEVER, when working in a team with less experienced developers, it is much easier (and quicker) to get them up to speed by saying "this project is built on framework X, read the framework documentation", than expecting them to master the theory and application of good patterns and practices in a reasonable timeframe.

I see these frameworks as good introductions to application design and Separation of Concerns, and find them very useful in team environments. That said, I believe that a good IoC container, and a handful of design patterns, can achieve the same results whilst being much more lightweight and flexible.

Darscan
A: 

Swiz is the most lightweight choice out there. Everything else I've seen (primarily Cairngorm/PureMVC/Mate) still has a lot of either code or XML bloat, which is something I want to avoid. I don't believe in replacing code bloat with XML bloat, just give me some tools to get the job done with less work!

Ajax Sucks