I've been working on an interesting
Adobe Flex project since last month, which I received because the original developer was too busy with other projects for the same client. The application itself relies on .NET web services for it's back end (must contain hatred for .NET web services while typing...trying...so hard...) and employs
PureMVC (
AS3 Standard) for the application's framework.
In most of my previous Flex projects, I tended to shy away from using a framework but, in the interest of exploration and learning, I built a friend's website in Flex and PureMVC (
bridgerconstructionservices.com). Recently, I've started to use
Mate (pronounced mah-tay, it is named after the delicious Argentine drink), which I like a great deal because it's a Flex, tag-based framework that, in my opinion, is easier and more efficient for developers to utilize. However, this post isn't about Mate or selecting one framework over another.
Back to my current Flex project: it took me about a week to get back into the swing of using PureMVC. The process of relearning PureMVC got me thinking about Flex and frameworks in general, which brings me to the point of this post:
Is the use of a framework in Flex overkill?
The reason for the question is because Flex itself is merely a framework for the Flash/ActionScript platform. In essence, using a framework in a Flex project amounts to little more than adding a framework (PureMVC, for example) on top of an already used framework (Flex).
When using PureMVC or
Cairngorm, a developer must create multiple files to accomplish a single task. For example, in my current PureMVC project I have 5 files to deal with in order to do the following tasks: call a web service and display the returned results. The 5 necessary files are: a command class; a proxy class; a value object; a mediator class; and a view.
This seems like a good bit of overhead for what is essentially a simple and commonly used task. In Cairngorm, a similar task supposedly requires more files than PureMVC. However, I'm not familiar with Cairngorm outside of some general reading, so please let me know if this is incorrect.
If I were to avoid a framework altogether I could accomplish this task (call web service, show results) in a single file; one that would not contain much code.
I don't know about Cairngorm but I can absolutely see where PureMVC excels for Flash-based projects. In fact, PureMVC is, in actuality, an ActionScript 3 framework (they have tons of ports and the AS3 Standard port is just one of them). It is not actually a Flex framework. The goal of PureMVC is to be a agnostic as possible, hence why it's an ActionScript port. If it were just for Flex, there would, most likely, be a need to make one for Flash and since Flash and Flex are both based on ActionScript, this seems like a logical approach to me.
In general, however, using PureMVC for Flex has not gelled for me. I don't yet see where it's supposed to make my life easier as a developer. I feel like it does the opposite; it encumbers me and makes it harder to accomplish required tasks in the application. I imagine this is because I am still a newbie as regards PureMVC!
During my recent explorations with Mate, I have found its approach intuitive and powerful. I think this is because it doesn't really feel like a framework. Mate (and this may be off-base) basically comes down to an EventMap component that you add to your project (along with the Mate SWC) that captures standard Flash Events and acts accordingly on them (ala a Controller); calling services, managing returned data, injecting views with data, etc. It seems to fit into the flow of a Flex project far more naturally than other frameworks. Basically, I've felt like PureMVC gets in my way when I am coding, while Mate doesn't.
Please note that this post is not intended as a dig at PureMVC or Cairngorm or an endorsement of Mate. I genuinely am trying to see the benefits of frameworks such as PureMVC and Cairngorm, which I lump together only in that they are more involved in their usage than a framework like Mate.
Any thoughts or comments? If a PureMVC or Cairngorm developer stumbles upon this post, I am very interested to hear what it is you like about your framework of choice and how you feel it benefits project development, maintenance, etc.