Flex vs. AJAX

01Aug06

Whenever people think about the next generation of web applications, many people are thinking AJAX. Others think Flex. These two worlds often collide, with many blog entries and articles written on the subject comparing the two, deciding which is the hands-down best technology for you to use on “your” website. The problem that I see with this is: “who decided that these should be competing technologies?” Sure they are separate methodologies, and learning both takes longer than just picking one and going forward with that. But, if you really want to build a quality web application, then it might be in your best interest to tough it out and just learn both. Really, they’re not that different from each other. If you’re learning one (or have already learned one), then a lot of that will carry over to the other. JavaScript and ActionScript are both ECMAScript-based languages, so they are very similar, not only in syntax, but usage as well.

I’ll give you a list of what I think are important strengths and weaknesses of the two, but keep in mind, I am happily on the fence when it comes to deciding between them, and I’ll tell you why in a bit.

Flex - strengths

  • - great for rich interaction and media heavy pages
  • - has Flex Builder IDE, built off of familiar Eclipse IDE
  • - Flex Builder has design mode for those non-programmers interested in building Flex apps
  • - greater access to multimedia components of your computer
  • - effective use of caching for improved speed

Flex - weaknesses

  • - ActionScript and MXML, although similar to JavaScript and XML, are not as common in everyday pages
  • - back button and right-click don’t have desired effects without enhanced coding

AJAX - strengths

  • - great for large text-based content
  • - Open AJAX Initiative
  • - also strong caching (depending on implementation) for improved speed

AJAX - weaknesses

  • - heavy amounts of JavaScript and DHTML to achieve certain dynamic effects
  • - no IDE with integrated debuger
  • - back button can easily be broken with certain applications of AJAX

As you can see, both have their strengths and their weaknesses. It can be apropriate in certain applications to use one over the other, and vice versa. But with that in mind, who’s to say that you can’t use them together? Well you CAN, taking the best from both worlds, especially with the help of a library for Flex, created by Ely Greenfield (one of the original developers of Flex), called the Flex-AJAX Bridge, or FA-Bridge for short. The simple summary of what this does is it allows your ActionScript code to be available to your JavaScript code. For example, if you wanted to change a value in your Flex app such as a panel width, normally you would have to do it through AcionScript with a line of code something like “my_panel.width = 250″. But with the FABridge library, you can do this through your JavaScript code, like so: “flashApp.my_panel.setWidth(250)”. You can read all about it on Ely’s blog, QuietlyScheming. I think he puts it best by saying…

Smart developers take the time to equip themselves with as many different tools as they can, and great web apps use the right technology for the task at hand.

For those of you that were sitting on the fence, looking for a nudge in a certain direction, hopefully I’ve convinced you to stay there. Try this solution out and see for yourself. There’s plenty of room on the Internet for both Flex and AJAX. If you come up with anything cool, feel free to share!

Charles


7 Responses to “Flex vs. AJAX”  

  1. 1 Andrew Laffoon

    Thanks for the great post, Charles. There is a lot of hype on both sides of the argument these days, and it is good to see an Adobe guy touting how well they work together. I’m looking forward to getting my hands dirty with Flex and AJAX in the next couple of months. :)

  2. 2 Charles

    Thanks Andrew. In the next short while, I’ll hopefully be posting some tutorials on Flex and AJAX integration using the FA-Bridge that I mentioned. Stay tuned…

  3. 3 Jon

    It seems clearly biased in favor Flex. Missing points. Cost, dependency from Adobe, pretty much undexable by search engines, requires server side install/reboot, …

  4. 4 Charles

    That’s true Jon, there are missing points, but missing both for Flex as well as for AJAX. Note though, that this post isn’t trying to promote one over the other, but rather to encourage the integration of the two technologies for your specific needs.

  5. 5 ken

    “but missing both for Flex as well as for AJAX.”

    while the cost point clearly puts flex at disadvantage

    it’s deliberately missing i’d say

  6. 6 Saurabh

    Hi, is it possible to make an image in an imagegrid of flex application draggable and resizable at the browser by using the ajax libraray to make the image draggable. I’m trying to use the flex-ajax bridge and the ws_dragdrop.js javascript

  7. 7 Charles

    Hi Ken. Actually, I don’t think that cost puts Flex at a disadvantage to AJAX. Remember, the only cost associated with developing Flex applications is in buying the Flex IDE, Flex Builder. However, you can get the Flex SDK completely free from http://www.adobe.com/products/flex/sdk/. The only difference is you don’t get the pretty interface that you do with Flex Builder, and you will have to compile your programs from the command line. But, there isn’t anything you can do in Flex Builder that you can’t do with the free SDK.

    So, in terms of AJAX, they in fact ARE on even playing fields. I would actually say that this puts Flex at an advantage because, although it isn’t free, there IS a powerful Flex-specific IDE available.

Leave a Reply



john wayne ringtonesmarillion ringtonefree atbattlestar galactica ring tonesfree verizone ringtonesverizon mobile ringtone

Social Bookmarking



View Charles Bihis' profile on LinkedIn

You are running Some Weird Browser