I have been a Flex and Ajax fancy for a long time. As the development of Adobe and Internet, Flash player becomes more and more powerful and popular, especially after importing ActionScript3.0 as it's script language. And we can aslo find that Apollo is going to be a powerful desctop developing tool by combing traditional techonlogies like XHTML, CSS, Ajax, Flash and Flex. At the same time Ajax seems to become most devlopers' favourite web developing techonology. Ajax is nothing new, but a new concept of web developing. Then how should we choose between Flex and Ajax?
First, I'd like to talk about why more developers would rather choose Ajax. What advantages does Ajax own? First of all, Ajax is based on Javascript, XMLHttp and HTML which cant' be more familiar to the devlopers. So the developers needn't to learn new techonlogy. And we know that the HTML is base of the current web. It's quite good at
text rendering while Flex is not so good at it. So some kinds of websites, such as Blog and Forum system, we have no choice but Ajax. What's more, although Ajax is not good for Search Engine's searhing, it's much better than Flex. So some websites that need to searched, such as bank websites, it's much better to use Ajax. What's more, it's much easier to position the different elements in the HTML page using javascript and CSS. Flex has css too, but doesn't work well like HTML, and sometimes you will find that it's hard to position the controls in the right place. Ajax brings new User Experience and people's desire to communicate with the machines. There is no refresh any more on the web, and it greatly reduce the web traffic and the server side response time. How cool it is!
Second, I'd like to talk about what disadvantages Ajax has. As we know, javascript has some terrible problems that we sometimes cann't bearing, such as the different support on different browsers and on different versions of the same browser. You can hardly image how raging we are when the javascript codes run perfectly in IE whlie it even cann't run in Firefox. However, people find some bright ideas to encapsulate the javascript to make it work on all kinds of browsers. That's what we know now, which is called "Ajax Framework". But in fact it doesn't completely sovle all the problems, for we have to spend some time to familiar with the Ajax Frameworks' APIs. And for the javascript language itself's problem, it's not good at designing the application using MVC design pattern, though some people and som companies have found out some ways to make it, but not good enough. Till now we still don't find some really useful debugging tools for javascript. So you will find it's so troublesome to write javascript codes and don't know what's wrong when it won't work. Then you can image how hard it is when we want to maintain and expand our products, especailly when the data is based on XML, for javascript's troublesome functions and low efficiency on parsing XML.
On the other hand, it seems as if there can't exist both lot's of text and media at the same application. HTML is good at text rendering. However you will see how hard it is to draw a circle in the application. We can hardly control the display of an image and the motion of objects. If the application has to display audio or video, we have to embed add-ins such as flash.
Now let me talk about the advantages that the Flex has. Flex is designed to replace some applications that originally developed by Flash. It has much more components for the web developing, and it greatly improving the capability of text rendering. For it's based on Flash, it's quite good at multimedia, such as charts, sounds and vedios. Flex Builder 2.01 uses ActionScript 3.0 as it's script language, which is a completely OOP language, and it's designed for MVC developing. So In Flex developing, you will find how easy it is to write ActionScript codes to parse XML data that returns from WebService or HTTPs Post or Data Service. And, of course, it's easy to maintain and expand our products by importing MVC design pattern. A little problem of Flex is that the swf file it generates is a little big, most of often, it's greater than 3M. However, when you want to make some cool effects, like dragging and wiping effects, it's much easier to do this using Flex than Ajax. And you will aslo find that there has been well designed components, such as Menu, Accrodian, Table Navgiator, Tree and DataGrid. That's really simple enough for us to use it and develop powerful functions applications. So in this way, I'd like use Flex other than Ajax.
Last, I'd like to have a summarize for "how to choose between Flex and Ajax ".
- If we're developing some applications that mainly based on text and need search engine's support, there is no wonder we should use Ajax.
- If we're developing applications that requires high interation with clients and with little text for some special clients, I suggest use Flex. And, of course, we can use Ajax if we have excellent Ajax coders
- If we just develop serivce needs to control images or sounds, it's better to use Flex
- There do exsit some applications that Flex can make while Ajax cann't, so in this situation, Flex is the only choice. Such as 3D translation.
- If we're considering much about the perfermence and different clients, Ajax is first choice
- If the project is big enough, and there is no well encapsulated Ajax Framework to help you developing, it's really not a good idea to use Ajax
- We'd better consider what we need and what our clients need before we start working on the whole project, and if we can, we'd better to find a already exsit Ajax Framework to help us developing. It's really hard to rewrite all the codes again.