Tag Archives: What is JavaScript?

Flex vs JavaScript why flex is better

Flex Vs JavaScript; this is a debate brewing up for long. Though both the languages have their own pros and cons and each of them has its fan following, you can’t do away with the bias that pops up in any discussion related to them.

Flex and JavaScript are both the different ways to develop the Rich Interactive Applications or RIA. Though JavaScript and Flex Actionscript are based on ECMAScript, there are some differences which make one better than other is.  The latest version of JavaScript is dynamically typed language while ActionScript is statically typed one. However, both of these are made for application development.

What is Flex

Flex is a programming language developed by Adobe Technology. Meant for developers, this language offers more tools to develop rich internet applications.  Equipped with all the Flash features, this language is comprised of two languages MXML and Action Script respectively.  For developing Rich Internet applications, Adobe Flex makes used of Sun’s Java environment.  For Flex coding, MXML is used that is based on XML.  All the Flex codes are complied into SWF (ShockWave Flash) files, like Flash. These SWF files can be directly executed in browsers having Adobe Flash Player Plug-in installed.

What is JavaScript?

JavaScript is also a programming language used to make web pages interactive. Most browser support JavaScript and visitors to your website can run your JavaScript if they have browsers supporting JavaScript. JavaScript is an OOP based programming language having built-in objects and functions. It allows users to build their own objects and functions.

Flex Vs JavaScript

So which one is better; Flex or JavaScript?  We are talking from the point of view of developers. For them language is better if it provides required framework and UI toolkits. While developing a RIA, developers do not want to do everything from scratch otherwise; it will lead to lots of additional work.

Let us talk about JavaScript first. It does have libraries like jQuery that helps you manipulate the broken document object model for all browsers. Supporting JQuery, there are several other plug-in also. In addition, there are JQuery Mobile and jQuery UI, though they are at initial stages only. Then there are ExtJA, Sench Touch for mobile development.  There are a few application frameworks for JavaScript including Sproutcore, Knockout, Backbone.js and others. However, the choice of framework depends upon the kind of application you are developing.

When it comes to Flex, most developers agree, despite all its features, toolkits, JS library or framework, JavaScript  is nowhere close to Flex/AS3 features. Flex has been there for years and its componenets developed   have been considered mature. It offers variety of components to deal with different cases. It offers great styling and skinning options, good documentation, many examples, layout management and data binding.  Moreover, if offers many non-visual components and classes to help you build data-driven applications. Flex is definitely better than JavaScript.

Let us compare both web technologies with the help of a comparison table

Flex JavaScript
Flex framework helps in creating rich user interfaces, as it is component-oriented and event-driven. JavaScript is a programming language.
It is used mainly to build a stateful application that runs on client-side only. JavaScript is good for cross-browser portability
To run SWF files created by flex, clients must have flex framework installed. No such restriction exists for JavaScript
Debugging is very easy with flex as it has an inbuilt debugger and profiler within the Flex builder IDE. For JavaScript, debugger might not be useful as it involves many browsers.

Action Script in Flex is easy to learn as it includes components of java and JavaScript and has strong OOPs support.

JavaScript has different syntax and execution for different browsers.