1. SKITSANOS.COM
AJAX vs. FLEX
raw technology comparison
Evgenios Skitsanos
2007
HTTP://WWW.SKITSANOS.COM/
2. AJAX Pros and Cons
AJAX FLEX
Advantages Pre-built frameworks can be leveraged, familiar to The Flash Platform provides a true application platform
those who know HTML, JavaScript, etc. no need for as a virtual machine thatâs browser / platform
additional software past an up-to-date browser, independent, including a JIT compiler and strong typing.
open standard.
The very intention for the Flash Player was to provide a
container to perform operations like rendering complex
animations and filter thousands of data sets at the same
time, thus providing a desktop-like experience with
comparable performance on the internet.
Very capable IDE, Images are part of a flash movie
and can't be downloaded directly, supported by
Adobe, XML based language, ability to leverage flash
components into the application, great speed increase
over previous versions of flash (if that was even
possible).
Moreover the code only needs to be written once
instead of several times for each browser as is the case
with JavaScript/AJAX.
Flex Builder has design mode for those non-
programmers interested in building Flex apps
Disadvantages No IDE, no browser standards (slight alterations per Needs the flash player, Need to learn and XML-based
browser), hard to build components outside of language and possibly ActionScript to build real
frameworks (in general), images and other data applications.
open and available.
Rare issue, but Flash 9 could be disabled or not
JavaScript support might be disabled on end-user installed {There are some solutions for software 2
browser because of the security reasons. deployment, like MS SMS.}
Skitsanos.com | http://www.skitsanos.com/
3. Ajax / DHTML applications are subject to each
browserâs implementation of the DOM and often
require developers to provide workarounds for each
variation thereof; this inherently creates additional,
unnecessary code and ultimately adds to the
development timeline. Large Ajax applications with
rich user experience = large development effort.
AJAX applications leverage the browser as the
application platform something it was never
intended to be used for. The browser is nothing more
than a text-based rendering engine, and was never
conceived as a container for client-side applications.
Development Models AJAX is the mesh of several, common client-side The Flex workflow and programming model follow a
technologies, overcoming the browser compatibility more traditional approach familiar to application
issues often requires expert knowledge of each developers. Flex applications are implemented using a
browsers interpretation of the DOM, and usually combination of declarative tags (MXML) for the user
leads to hack-like workarounds. Even if youâre using interface / presentation and a scripting language
an Ajax / DHTML toolkit, youâre still subject to the (ActionScript) for complex business / application logic.
pains of cross browser issues.
· MXML is an XML based, declarative language
Ajax often entangles both HTML and JavaScript to thatâs similar to HTML and is used for layout.
create rich user interfaces where the end result is a · ActionScript is a strongly typed, classed based
tightly coupled client application thatâs often difficult OO language analogous to Java, but with the
to maintain and extend. flexibility of a scripting language.
While the MXML and AS arenât native to most
traditional app developers, the development paradigm
is a similar model to that of JSP and Java development,
making it an easy transition for seasoned developers.
Flex Builder offers a professional IDE based on Eclipse,
with the usual myriad of tools an application developer
expects. 3
· Debugging is built on top of the Eclipse
Skitsanos.com | http://www.skitsanos.com/
4. Debugging Framework and provides common
tools like setting breakpoints and watching
variables
Cost Some of them free, but AJAX frameworks that more Free
or less can be considered as compete ones with Flex
are quite expensive, the cheapest one is Backbase Flex 2 includes a number of free features, such as the
with price starts from $6,000 per CPU. Flex SDK (software development kit). The real changes,
though, are in pricing, where Adobe is looking to
reduce the cost of simple Flex deployments.
With Flex 2, Adobe is permitting free single CPU
deployments of Flex applications using the Flex Data
Services 2 Express or XML and Web Services.
Previously, Flex users paid $15,000 per CPU to get
started with the Flex SDK, which was part of the Flex
Presentation Server.
Bandwidth Sometimes requires transmitting application bits and Less bandwidth for data, since it passing just data, with
pieces as well with actual data. no need to pass application bits and pieces
Performance Slow, bad code can affect performance of whole Flash is much faster than JavaScript and Flash will
application and even freeze browser. improve in the future as the flash player gets faster.
JavaScript however will not increase in speed much in
the future as it is an interpreted language.
The performance implications of running a complex
Ajax application are subject to the browserâs ability to
interpret JavaScript and determine the type at runtime
is it a string, a number, an object? Whereas ActionScript
3 (AS3) eliminates type look-up because its strongly
typed and compiled into bytecode rendered by the
Flash Player VM this facilitates better responsiveness in
your application.
Expandability Hard to create custom components. Third-party Easy to create own custom components and re-use them
components might not work with existed ones, within application.
browse incompatibility issues.
The Flex Framework provides a rich, robust, and
extensible set of UI components that facilitate rapid UI 4
development with MXML, the declarative presentation
layer. Furthermore, MXML is simply an abstraction to
Skitsanos.com | http://www.skitsanos.com/
5. ActionScript (MXML is compiled to itâs complimentary AS
objects under the covers â itâs analogous to what JSTL
is for Java), enabling developers to create complex,
custom components with a blend of MXML and AS.
Data Ajax support XML. With Ajax, and XML in Flex, you Flex supports XML (http or web services), AMF (a lot
are creating and parsing xml on the client and smaller and faster), RTMP (push), data services, native
server. In general xml parsing is slow, you'll never data type support, Value Objects.
notice it will small records. But a grid with a couple
of hundred or more records and you will notice it. FDS (Flex Data Services) provides the ability to perform
This is when AMF shines. data push from the server in the form of pub / sub
messaging; thereâs a Java adapter that allows Flex
AJAX typically requires some type of data clients to subscribe to JMS topics and additional
transformation in the middle layer and client side, adapters can be written to subscribe to legacy / other
adding an unnecessary performance overhead on messaging systems. In addition, FDS provides data
both sides of the wire, eg: synchronization, an API that abstracts the action of
· Client makes an asynchronous HTTP request capturing all the data deltas on the client and persisting
for data them to the server, thus enabling developers to focus
· Request is mapped to a servlet / JSP that more on the application and business logic. FDS allows
uses JDBC to query your database provides data paging for large data sets and handles
· Data is transformed into an XML doc (or temporary disconnects transparently to the developer.
JSON) and sent as an HTTP response
· Client receives the XML and must parse it
into useable data
Flex can make calls directly to the back-end by
invoking methods on Java objects, like POJOs or
EJBs. These objects are transparently serialized and
deserialized by the FDS application, mapping your
client-side ActionScript objects to your back-end
Java VOs, DTOs, or whatever other pattern(s) your
architecture enlists; the developer is just left to
expose the java objects to the flex client via a
couple thin lines of xml in remoting-config.xml.
XML Supports Supports 5
Data pushing Not supports. AJAX is browser based, and therefore Supports
limited by the ârequest/responseâ paradigm.
Skitsanos.com | http://www.skitsanos.com/
6. Somewhat functionality could be achieved with
Adobe Spry Framework for example, that does let
you hook up an XML feed to your front end and
automatically refresh it at a certain interval.
Streaming Not Supported Supports
Access to media devices Not Supported Supports
6
Skitsanos.com | http://www.skitsanos.com/