Recent Weblogs

Links I like

Script Wars, Action vs. Java

I recently attended the Ajax World Conference in NYC. Ajax has taken on a meaning much different than its original acronym represented. Ajax is the idea of asynchronous calls to a web server from a web client, regardless of client technology or data format on the response. The speakers typically refered to applications and gadgets built with Javascript as Ajax, and application built in the Flash environment were typically refered to as Flex. So thats what everyone was saying throughout the conference, Ajax and Flex. I would say its probably a good branding promotion for Adobe to have everyone call it Flex over Actionscript but thats what it is, another flavor of ECMA.

ActionScript advantages

I've coded in both languages and I will say without a shadow of a doubt that Action Script (I will be refering to 3.0 in this document) has some clear advantages. First and foremost browser compatibly, once your user is in the Flash environment it doesn't matter what browser they came from, the flash platform is universal and there are no model incosistancies like you have with Javascript. Animation and non-rectangular shapes are two things that Flash handles oh so well natively which makes for a fast track to a smooth UI.

Javascript advantages

Javascript is the native programming language for many browsers, all GUI based browsers have support for JavaScript. Javascript builds DOM Objects which fit inside HTML documents which can be accessed via CSS. Your programming design now spans the breadth of 3 well established technologies, all of which the browser natively supports. Javascript is built in runtime only, which allows users to customize libraries through methods of composition.

ActionScript disadvantages

One of the most inconsistant models in the browser world is the flash detection model. IE has support only through variables in VBScript, its a mess that Adobe can't even properly address the Adobe's flash detection kit gets you 90% there but even then there are users that can break it. No DOM Model, something that I have relied on plenty of times in Javascript programming is the DOM, although Actionscript variables are strongly typed there is no DOM support, finding elements children is tricky and when you get into the question of "chrome" it gets even worse. Weak CSS implementation, the Flex library has a Style class but its abilities are limited to a one level listing of properties, most of which are inaccessible via the Style tag, important ones too, such as width.

Javascript disadvantages

Development can be a headache in Javascript, with a runtime only language its hard to catch "compile time" errors, mis-named variables to passing the wrong arguments to function calls. Firebug and other tools have been a great step forward in catching the "silent killers" but still it is a mile behind the experience you can achieve in the Flex Builder IDE. No class hinting on function calls or return types, I believe this to be a disadvantage and blessing but most figure this to be a pitfall.

The Middleground

Each technology is useful for many of the same tasks but a few questions I ask myself before building a web application are.

  • Who is the audience?
  • How big is the audience
  • How often are they going to use this?

If your audience is the AARP you're probably going to stick with some transparent Javascript. If your audience is the League of Young Voters, go for some flashy flash. Other considerations are.

  • How often is project scope expanding?
  • How many members are on the development team?
  • When is the deadline?
  • What features are already supported by either framework

Actionscript is by itself lacking a lot of UI functionality, thankfully Adobe has provided, for free the entire Flex Class framework which includes tons of controls and layout objects to assist in application development. For Javascript there is prototype which assists in native functionality and with Asyncronous requests but has little to do with rich UI components. People such as myself, Nitobi, Backbase and many others have been working to build a UI Framework like Flex. So frameworks have a lot to do with the battleground, but certainly do not predict the outcome of the war.


Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'mfoster'@'' (using password: YES) in /home/content/m/a/t/mattfoster01/html/includes/php_common/lib/classes/abstract.mySQL.php on line 15

Fatal error: Uncaught exception 'Exception' with message 'Failed to connect to mySQL server in method : mySQLBase::connect' in /home/content/m/a/t/mattfoster01/html/includes/php_common/lib/classes/abstract.mySQL.php:16 Stack trace: #0 /home/content/m/a/t/mattfoster01/html/includes/template/comment.php(29): mySQLBase->connect('', 'mfoster', 'havef8th') #1 /home/content/m/a/t/mattfoster01/html/blog/2007/04/actionscript-vs-javascript.php(92): include_once('/home/content/m...') #2 {main} thrown in /home/content/m/a/t/mattfoster01/html/includes/php_common/lib/classes/abstract.mySQL.php on line 16