Ajax vs. Flex revisited +

Eight month ago I posted this entry in german. After a comment that this post is needed in English, I will translate it and rethink if I would confirm my pro and con.
Could you compare Ajax and Flex? Sure! Both are technologies in the web frontend, which cover the same domain.
Should you compare Ajax and Flex? Sure! To learn more about the strengths and weaknesses and pull the right technology for the use case out of the hat.
What are the pros of Ajax?
- HTML, CSS and Javascript are widely known and there are a lot of people who have programmed with this languages
- The end user is very familiar with it. He knows the browser very well and knows how things are working, what buttons look like and where he could click, …
- There is no need for a plugin, because everything is supported natively in the browser (plugins could be a huge problem in controlled enterprise environments)
- Client and server side patterns are very mature and you get clobbered over the head with frameworks (in a positive way). Webwork, Struts (1 and 2), Spring, Turbine, Tapestry, JavaServer Faces, … in the Java world, YUI, Prototype, JQuery, Dojo, Ext, … in the Javascript world (to name just a few).
What are the cons of Ajax?
- It still is HTML with all its weaknesses. Rounded corners, small effects, browser incompatibilities, … … nearly everything is possible, but it is often laborious and not really straightforward
- Ajax is based on Javascript. At the beginning everything seams to be great. But then you realize, that you are just scratching on the surface and you are falling in a deep hole. When you are back at the top, you can see the strengths of the language
- The Javascript/Ajax frameworks are getting better and better. Two years ago there also exist a lot of frameworks, but they weren’t very mature or well documented in some parts
- The performance can suffer a lot of from the use of DOM manipulations. Sortable tables or other complex operations are working at limit of the practiable
- Browser and their technologies have evolved in the last years, but HTML wasn’t created to be dynamic.
What are the pros of Flex?
- Steep learning cureve at the beginning. After a few days you can create applications, which would take longer with HTML, CSS, and Javascript even after some years of training
- Sexy interfaces. A Flex application looks better at the first sight. Rounded and transparent layers, gradients just as you like them without complex scaling background images. Small effects just working after two lines of code and doesn’t have an impact at the browser performance
- Integration of multimedia data. A video player or a control to play MP3s, just a few lines of code. Clean and straightforward
What are the cons of Flex
- A Flex application looks like a Flex application. Not a big downside, but a designer needs to learn how to style it. Else you just got a 08/15 application, what can be a problem when Flex is spread wider
- Small application can be developed really fast, but if an application gets larger, you are loosing yourself in Flex. Frameworks like Cairngorm solving the problem but the learning curve is getting flatter and flatter
- I18N, automatic builds and code generation are possible but a lot of enterprise features are hidden very well. The community around Flex is growing but in a lot of areas you are alone with just a hand full of google hits
- Flex is generating Flash and the language MXML is in the opposite to pure Actionscript the strength, to get faster to your goals. But Flex is just on top of Flash and the separation of MXML and Actionscript is often to fluent, to be very homogeneous
- The FlexBuilder is no IntelliJ and the tools are still very unpolished. The development of applications is possible but it could be a lot better in some parts
Conclusion:
If you need a multimedia application with some content which should look very nice, then Flex fits very well. But if you want to manage data and you want a wide support for your application, then Ajax is still the better choice. Flash still feels like a foreign object in the web. Deep links, copy of content, loading time and the existing knowlege and usability of HTML are arguments against Flex. But if the web application should feel as close as possible like a desktop application, then Flex is a good way and maybe the AIR technology is the goal. When developing a touchscreen application we also had the decision between Flex and HTML. I think it was a good choise to try Flex because of the interface speed (no page rendering) and the missing page reloads. It feels more natural for this kind of product.