Friday, March 27, 2009

Swiz is the Shiz

Now that I am doing more Flex development I am back to researching MVC frameworks for the Flex client. I initially did what most Flex developers do as they start learning and create inline code that cannot be maintained. From there I went to the other side of the spectrum and tried Cairngorm which did exactly what it said it would do but at the price of being very heavy but keep your code organized. The biggest problem with Cairngorm is that it lead to code explosion with all of the objects it required you to create. Needless to say I wanted to find something simpler.

I then researched some other available frameworks like PureMVC and Mate. PureMVC looks like and octopus of classes and seems like a Cairngorm like framework with incremental improvements. Mate was a lot closer to what I wanted but seemed to introduce too much custom framework.

Finally, I found Chris Scott's Swiz framework. Swiz works that way I think since I do so much Spring development in Java. Swiz's main goal is reduce the clutter you maintain in Flex like singletons and service locators by using dependency injection of your components in your application. Swiz also comes with a very intuitive annotation model for dynamically dispatching and registering event listeners to your methods. All of the nonsense you would normally write with some of the other frameworks are abstracted in Swiz and you end up with little framework noise. Visit the Swiz site and look at the docs. You will be up and running in about an hour if you understand how dependency injection works already. You can also check out Christope Coenraets Swiz example for a simple running example. Also look at the Flex 360 video from Chris Scott for a full explaination about this framework.

No comments: