Home  >  Development  >  blogs

When to Use Flex + AJAX

| | Comments (3)
AddThis Social Bookmark Button

Ok, this time I'm feeding off of Andre's post on Ajax And Flash Playing together. I prefer full-Flex applications, but you often come upon the scenario where this is not an option or is not cost/time effective. The purpose of this post is to highlight some scenarios & reasons where you would want to use both Flex and AJAX together, but also point out some of its limitations.

Leverage Existing Infrastructure
If you already have an existing AJAX codebase and infrastructure hat you want to reuse, why rewrite it all in another technology? You can use Flex/Flash to augment the capabilities of your application. If you need custom charting, custom data visualization, or want to incorporate real-time messaging into your application, you can just build the new functionality and integrate it into your existing application through either the Flex-Ajax bridge or ExternalInterface.

Caution: this approach introduces more technologies into your stack. Mixing different technologies often results in more complex application architectures. You now have APIs for communicating inside of the client-side architecture, rather than simply integration to the backend services layer.

Mixing different technologies also requires different developer skills. You should carefully weigh all the pros and cons before choosing to mix. Which leads me to...

Leverage Skillsets
If you have a team of web developers who are very good at AJAX development, but only have a limited number of Flex/ActionScript developers, then you can build your application so that the development process is efficient and effective. You have the option to decide which pieces should be Flex and which should be AJAX, so that your team is most effective and most productive.

Leverage Runtime Capabilities
Let's say that you only want to utilize the Flash player for video & audio, charting, special animation, or other graphical capabilities... Why Not? This technique is used all over the web from video players, to audio players, to street-level maps, etc... Note, These links aren't necessarily Flex, but are all capable with Flex b/c of the Flash runtime.

Integrate With 3rd Party APIs

Not all API providers have actionscript-only, or AJAX-only APIs. If you have a Flex application, and want to interact with a AJAX service API, then you can do it. There is no need to setup a proxy to convert data, when you can access it directly. This also works in the opposite direction; If you have an AJAX application and want to interact with a LiveCycle Data Services or a remoting layer, then you can do it. You can create a 0-pixel Flex application that strictly interacts with the services layer and communicates with the AJAX application through ExternalInterface or FABridge.

Another word of caution is that AJAX and Flex applications don't necessarily support the same graphics effects and capabilities. You have richer capability for graphics in Flex/Flash, but you should keep the limitations of AJAX in mind when designing and building your application so that you have seamless integration between components.

What this really comes down to is that you have choices in building your applications... lots of them.

Comments

3 Comments

Rhys Tague said:

I think that it is good that you can use both technologies in a application. But I reckon that when building an application you should stick to one API, To keep consistency through out your application.
Yeah Flex has some great components that are pre-packaged (you can also create you own) but so does Ajax as well (through Ajax libraries)
Really planning your application before diving into developing will give you a better understanding what technology you will benefit from the most Flex or Ajax and stick with it.

Me personally I love Flex because of it's interoperability in browsers because of Flash Player.

great post all good points. I forgot about the 3rd party APIs and mashups factor. it's definitely a big decision point for a lot Web2.0 type sites, but also behind the firewall there are a lot html components like portlets that are often easier to integrate into an Ajax UI.

Overall thought I think leveraging skills and infrastructure should always be very high to decision making priority list. There's still a lot more HTML/JS developers out there, so maybe it's better do smaller bits in Flex so you get the most bang for your buck.

FYI. You're audio player link goes to the maps site too.

Both technologies can achieve the same goal, but via different paths.

"Flex vs. AJAX" ... when you take the fear out of it, Flex and AJAX can peacefully co-exist in the same browser without any debate.

Leave a comment


Type the characters you see in the picture above.

Tag Cloud

Related Books

Development Series

Get an overview of the tools and technologies that work together to allow developers to build Rich Internet Applications (RIAs) quickly and easily.

Anatomy of an Enterprise Flex RIA

Archives


 
 


Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.

About Us
Meet the Experts
Meet Our Contributors
Send Us Feedback