Flex or Ajax? Or both?

[Edited on April 10, 2008]

Two weeks ago (counting from this post date), while talking to a colleague, I found myself trying to find out reasons to say that Flex easily outcomes Ajax. The truth is that it’s much easier for me to talk about Flex than Ajax, in fact, I’ve been programming on Flex 2 for the last 9 to 10 months.
Still, I claim my self has being technology agnostic… So I went searching about Ajax and how it is related to Flex. And the main conclusion is that both of them aim at something… the Web 2.0. How they do it it’s a different story.
Ajax its a set of technologies that allows the incremental update of website pages without having to refresh the whole page every time the user makes a request. If you’ve read my Web 2.0 post, this is how Ajax makes websites more responsive. Still, if users want rich GUI they will have to rely on JavaScript (which in fact can be very tedious!).
Flex, on the other hand, is a presentation tier and server which allows the development of Desktop-Like web applications. In fact, Flex developers claim that they don’t develop websites but yes web applications. And this is easily proved because websites are a sequence of pages (static or dynamic) while Flex applications only (this only is more like everything) reflect the values of each variable in every state… and that’s what Flex applications are.. a sequence of states!

Lets then compare Flex and Ajax…

Flex strengths
  • Great for rich interaction
  • Great for accessing multimedia components
  • Effective use of caching for improved speed
  • Client side debugging
  • Flash player insures cross browser compatibility (and it’s free)
  • Open Source SDK and IDE
  • Better performance – code is compiled – better handling of large result sets
  • Collaboration/Real-time natively supported
  • Offline /desktop operation supported
  • E4X makes XML handling very easy.
  • The Flex components can be easily extended, and new ones written. The Eclipse based Flex Builder is also significantly extensible.
  • Charting API (although not free) it’s just amazingly great!
  • Native support for vector graphics
Flex weaknesses
  • Back button, but specially, right click require lots of enhanced coding;
  • [Flex 3 has great support to HTML – no longer a weakness :D] HTML usage… As far as I know, all that Flex allows, regarding HTML, is to overlap HTML pages making it look like if they were in fact embedded in the application itself. – using for that JavaScript calls;
  • [No longer a weakness] ]MXML and ActionsScript, although powerful, are not so common – learnig curve is obligatory bigger;
Ajax strengths
  • Great for large text based content;
  • Allows strong caching using HTTP protocol for it;
  • Graphically good.. although tedious JavaScript is powerful, specially if you happen to master it;
  • Open Ajax Initiative. Lot’s of open source solutions;
  • Collaboration/Real-time can be emulated;
  • Very popular. A lot of community drive;
  • HTML fully supported (nobody would expect something else!!);
Ajax weaknesses
  • [Still a big problem in my opinion] Back button and refresh button can lead to really awkward and uncomfortable situations when using Ajax;
  • Lots of generated code – difficult to debug client side;
  • Performance can be an issue – code is interpreted – DOM-handling is tedious;
  • No offline/desktop operation possible;
  • [Most due to JavaScript issues] ]Browser compatibility – requires lots of hacking to ensure that everything works.;

Better together?

Well, the answer to this question is the same for the Flex or Ajax question. In fact, it is the answer for many questions! It depends.
If you’re not willing to make a 180º turn, Ajax is really great if you are looking to increase the user interactivity of your website. Ajax its not technology, but still it can make websites much more responsive. And if you have great HTML and JavaScript expertise you can also have very rich User Interfaces. A good example is wordpress itself, that is in fact very responsive.
If what you really need is to develop an application where you require sophisticated and interactive data visualization, such as a decision support tool, or that requires video & playback or web camera / microphone capture, such as a video conference application then probably Flex would be the best option.
Finally, if what you need is to combine large amounts of text based content with rich interaction components, such maps or charts, the best option is to user both as one. And this can be achieve by using the open source FABridge (Flex – Ajax Bridge) that was developed by Abode. An example of such situation is Google Finance.

Advertisements

0 Responses to “Flex or Ajax? Or both?”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: