Drop your framework?

After attending an interesting session at Adobe MAX 2008 titled “The Flex Architecture Face-off”. At first I though the speakers (Yakov Fain, Chafic Kazoun, Todd Anderson, and Joshua Noble) were going to debate which framework was the best, you know, Cairngorm, PureMVC, Mate, and others. Initially the speaker surveyed which frameworks developers were using and not surprisingly, most were using Cairngorm (followed by PureMVC, then Mate). Then the speaker asked who wasn’t using a framework at all, and I was again surprised to see that about half of the audience wasn’t using any framework. You see I come from the thought that you need to have a framework in your box of tools to build most projects, they help coordinate group efforts, and they offer support. I had always just assumed that most Flex developers would be using some type of framework and that the flavor of framework was the only point of contention.

What made this particular session interesting was how the discussion turned into a debate, not about one framework versus another, but a debate about if you want to use a framework at all. The panel was mostly split. Chafic and Yakov were obviously not for using frameworks, while Todd and Joshua recommended using frameworks. The reason for using a framework varied. Some developers use them because it helps to coordinate the work when you have groups of developers, others use them because the client had stipulated that it was a “best” practice to have a framework. This make sense because you know that even though projects have a development life cycle, they will also have a maintenance life cycle. This means that the next group of developers coming in after you will need to go through your code and using a framework seems to facilitate this process.

This has my view since I started Flex. I enjoy using frameworks, even though some require extra work and setup, it just makes things easier to work in a group or hand off your work to others. It just feels comfortable to me, safe I would say. I would typically use Cairngorm for most application development, small and large because I am familiar with this framework and its widely used. If someone told me they were not using a framework, or I had to pick up code that was written without one from other developers, I would most likely cringe because that would require me to learn their way of doing things. This was also a big part of the debate, how to deal with handing projects off to others or working in groups if you don’t have a framework handy.

I remained skeptical and listened to how Chafic and Yakov explained how they handled these issues without using a framework. What may seem obvious, but might be overlooked, is that Flex is already itself a framework and most of the micro-architectures build upon the Flex framework using patterns (Mediator, Proxy, Command, etc.) and the built-in event dispatch system. If you know what you are doing with patterns and can build loosely coupled components, you can get by with out using a framework in your Flex application. You would essentially be building black boxes (components, modules) that know nothing about other components of the application. Communication would still take place through event dispatchers and listeners. You can also use a pattern to build communication for server communication and data retrieval. This is so reminiscent of my early Flash development days, when we didn’t really have a framework to build upon and we sort of invented our own communication system, mostly creating components with publicly exposed properties and methods.

Another argument for not using a framework, or perhaps a complaint about them, is that they require a lot of extra work and code setup time without really allowing any benefits for the developer. They are also traditionally hard to learn (some more than others). For example, Yakov said he didn’t like Cairngorm that much until he learned PureMVC (which he liked much less). I had the same feeling about PureMVC, it really feels like a heavy burden to create proxy and mediators over and over again, making all those delegates/commands much easier to create in Cairngorm. This made me think a bit about why I use a framework and what it might be like to not use one. I have done this on smaller applications where you might communicate with compiled SWC file that wraps an API like Flickr or Yahoo Maps, but I often try to put them into proper place within PureMVC or Cairngorm because I didn’t want them in my views.

I still get that feeling that when I don’t use a framework, I am somehow not being a responsible developer. When I started doing Flex, I really wanted to use patterns and best practices, using Cairngorm makes me feel like I am following some agreed upon conventions for building Flex applications. Not using one really makes me feel that the next person that looks at my code will be like “WTF is this spaghetti code?”. You know that developers often back bite the previous developers when they pick up a project. Cairngorm at least gives you some feeling that I am using standards that can be picked up by other developers. This is especially true when you want to train new developers or work with groups of people.

However, I think there is some value to building Flex applications without using a framework. I was persuaded by the methods Yakov and Chafik’s mentioned for developing without a micro-architecture framework and the small gleam of freedom that shined in their eyes when they said they don’t use one. Your development group can use an agreed upon convention for modular development and communication between components. Each person can build a smaller component that exposes public methods and broadcast events that other interested components can subscribe to. Also, rather than using a delegate/command to handle your business logic, you can create or wrapper API’s that handles the data calls and broadcast the events, much like adding the Flickr SWC file to your project. Some value for not using a framework might also come when you have to build an application or prototype fast, such as done within Agile Software Development. Jesse Warden just published a three-part series about his experience doing agile development and mentions how frameworks fit into this style. For more info, check out his Agile Chronicles series.

Abandoning your framework probably works best within small groups of developers that know each other and are confident in Flex. If you are not working in such a group or you are concerned that your own methodologies for Flex might not easily support maintenance after you are gone, its probably best to use a framework. The session ended up being more a question of using a framework at all, rather than debating which one is the best or most popular. What I would like to see is some examples by Yakov and Chafic on best practices for developing Flex applications in a group when not using a framework. I think its may be the way I go for my next personal project, but a few pointers would be great.

So, do any of you have an opinion about using a framework or not? Best practices applied when not using a framework? Examples? I would love to hear them.


I found another discussion about this topic from the FlexWizz blog article titled “Why I hate MVC”.

Todd Anderson also posted some of his thoughts about the panel discussion at MAX.

InsideRIA posted a complete review of frameworks with examples. They also ask “why use a framework at all?”

– Mr

Reblog this post [with Zemanta]


  1. There’s just one thing I want to know. How big is the biggest non-Framework project that has been built by an anti-framework developer? How many months until that application reached a critical-mass, in which simple features could no longer be added without it taking weeks of refactoring?

    I read a wise quote from somewhere that said something like “The purpose of a framework is to reduce code change.” The point is that it’s not supposed to make the first 2 weeks of a project any faster, in fact it makes the first 2 weeks slower; but it will make the second year of development manageable instead of impossible.

    So the question of whether to use a framework should start with: “Am I writing a dinky little iPhone widget, or am I writing an enterprise-ready application?”

  2. I agree to this in principle, it seems that you can’t develop a project without a framework or a plan. But it can be argued that Flex is the framework and you can build your own kind of mini-framework. However, I too would need to see how large projects are handled, and how well projects are handed off to other developers. I had a feeling from the way that Yakov and Chafic spoke that they didn’t seem to think there would be a problem.

    It could also be that they didn’t see the need to worry about handing off the project to others. Yakov did seem to indicate that the had a lot of pre-built components the use to handle data calls and communication to the back end. Todd and Joshua both argued that they had lots of devs and moving parts, so having a framework seemed to work for them.

    I would love to see the code, it is interesting proposition. Does a framework just echo what you have within Flex, can you build a smaller MVC system that meets your needs if you build more modular applications. Also, if you read Jesse’s article, agile is presented as a mad dash to get something done, you might not have time to even implement a framework, its all about refactoring. To me there should always be time to set up some type of framework if its needed as part of the project.

  3. […] Drop your framework? … a bit about why I use a framework and what it might be like to not use one. I have done this on smaller applications where you might communicate with compiled SWC file that wraps an API like Flickr or Yahoo Maps, but I often try to put them into proper place within PureMVC or Cairngorm because I didn … […]

  4. It sounds as though our backgrounds are similar. I came up through Flash/AS2 and now all I do is Flex/AIR. As I began to understand Flex better, and still have a long ways to go, I realized that there were these other frameworks that “serious developers” used. So I started poking around at them and totally didn’t get it. Finally I ended up on a project that used Cairngorm and absolutely hated it. I would have to be pretty desperate for work before I’d take on a project that used Cairngorm, or any other framework for that matter. ( Although I’d give Mate a shot. )

    As a freelancer I’m the solo developer on almost all my projects. I don’t mind working on a team but I find that the best teams are one client side developer, one sever side developer, one designer, one manager, etc. Really, a competent group like that can build a huge application more effectively than say two of each, in most cases, because the more people are on a team the less effective each becomes. That’s my feeling anyway.

    I don’t really understand what Harry is getting at with you must have a framework to build an enterprise app. I can build an app of limitless size without one.

    Then again, maybe I do use a framework, but it’s mine. I have an event dispatcher class that I use for all events communicated between components. I use the hell out of value-objects. I can’t think of anything else that I need.

    Someday soon I’m going to do a video tutorial on just how I go about building an application. Not to show people “how it should be done” but just to show people how I do it.

  5. @polyGeek Would love to see your post on how you create enterprise applications without using a micro-architecture. I have some idea of how I might do it and it sounds like you developed something along the same lines. Todd Anderson also mentioned his thoughts about the panel discussion, he was one of the people supporting using Cairngorm in certain situations where you may have to hand off your work to others or work in a group of developers. You can see his post on his blog page: http://custardbelly.com/blog/?p=76

  6. @Mister, Thanks, I gave CustardBelly a read. This subject has got me thinking about how I build apps and some of the tips that I should write down for myself to follow. Like: always assume that the states of your app are going to be way more complex than they seem in the beginning. That’s what I learned on a project I’m wrapping up now. It started out simple so I used simple states management code. But then the client kept making exceptions and adding features and I ran into stupid issues like, “is this background image supposed to be visible or is that one, or…” If I’d started with, “this could get complex so build something that’s very adaptable” then I would have been in much better shape. So, lesson learned.

  7. @polyGeek What do you think about making up some kind of OmniGraffle chart to map out the communication you use during one of your projects. This way you can outline the basics of your non-framework ideas. I think it would be great to have these examples from the community as I see the definite need for this to be part of the framework discussions that seem to be ongoing. I think this would definitely be helpful for developing small and large-scale applications and also identifying the pitfalls associated with building complex applications without one’s handy micro-architecture. I read your latest post on “Transforming components in 3D with Flash 10/Flex 3.2”, pretty cool. You must have a lot of time on your hands ;).

  8. @Mister, let me put together a video tutorial on my development process and then we’ll talk. There’s every possibility that you, and everyone else, is going to say, “Dude, you’re an idiot!” 🙂

    In regards to your question, “You must have a lot of time on your hands”. I’ll have you know I’ve worked a solid 5-6 hours so far this week – it’s Wednesday. But I’m really hoping to cut back next August and only work 20-25ish hours a month. 🙂 Well, that’s paid time. I have a lot of other projects that I’m working on.

  9. @polyGeek, I am working my way towards that schedule some day :D. I would like to see the video and provide any feedback that I can, it would be great to see the process and hopefully I am not the first dude to say “what you smoking poly!”

Comments are closed.