Wednesday, June 16, 2010

Swiz & Flex 4 are a great pair

OK maybe a bit of big claim to and I held myself off from saying a perfect pair. That being said they do work very well. I know yes there are other frameworks but for me this came up on top. Why you might ask and who did I look at? The frameworks I looked at was Mate, Parsley, & Swiz. I've been using Cairngorm since its 0.98 release and thought with Caringorm 3 coming out I'd look at the other frameworks. There is a lot of hype about Inversion of Control (IoC) and Dependency Injection (DI) which these three frameworks are based upon. Which we can thank our Java friends for bring this into our realm. But there is a significant difference between how Java IoC and DI Frameworks implement and how ActionScript can. That is Java has Annotations and well ActionScript doesn't. Since ActionScript doesn't have annotations the closest we have is MetaData which is essentially a piece of text the runtime can get access to. Where Java's Annotations are essentially Classes which are typed we have to deal with text which more often that not leads to typo bugs at runtime. So that is a down side all three of these frameworks and is not going to change till Adobe tackles this problem.

I first started with Mate and coming from a ColdFusion background I thought it would fit with me well. But I found myself getting annoyed with all the tag syntax. This is probably more a personal preference thing but for me tags are great for layout/UI and script for business logic when it comes to Flex.

I then tried Parsley because everyone seemed to be really into it. I found it somewhat overload with features. Where and why you would use those features seemed somewhat undocumented. Probably the most annoying aspect is that I just wanted a simple MVC example of it in use and there was none. Yep there are snippets of code but when your starting out its nice to poke around a complete or suggested solution. The reason is that Parsley has a non-prescriptive philosophy. As in you use it as you think you should. This lead me to frustration since I'm not one to read through pages of documentation trying to piece the picture together. I just want to see the picture.

After leaving my frustration of Parsley behind I went on look at Swiz. To my surprise it was well, under-documented. But it has a simple MVC example of how you could use it with Flex 4 and 3 if so wished. The example goes over the concepts and how you do things in it in the example application and you can get it from there git repository. Existentially what they did is show me how they think Swiz should be implemented. This is very similar to Adobe's approach to developer education which is to bring people from newbie to beginner-intermediate/productive very quickly. Like Adobe Swiz let's you figure out the hard stuff on you own. You might be thinking that is not a good reason... but as far as I'm concerned and my clients I need to get up to speed quickly.

Well this post is getting a bit long so I'll finish up quickly on why Flex 4 is a good match. The reason for this is that Flex 4 fits well into presentation layer of Swiz. So your views are more visually focused and your logical is separated out into the presentation layer. This frees me up to focus on all the business rules with out getting hooked up in the visual side. Skinning in Flex 4 fits well into this idea as well. It's like the layer above the view if you are thinking of your application in a MVC pattern. All of this makes it really easy to hand off visually elements to the (Flex/Flash) designer to implement.

No comments: