Today is a good day to code

Java vs Flash vs AJAX

Posted: December 31st, 1969 | Author: | Filed under: Uncategorized | No Comments »

Java vs Flash vs AJAX

Picture of IrvinI was reading a very interesting article on the linux.sys.com site ( http://linux.sys-con.com/read/333329.htm ). The author was illustrating why Java , while being the language of choice at the beginning for rich application development, has faded away into nothingness on the web. What was interesting about this was that the author indicated his clear preference for Flash over Java and AJAX type technologies.

I don't agree with him for several reasons. First, I agree that JavaScript is at the end of its life. I think that AJAX has solved a bunch of problems developers used to turn to Flash to solve. Obviously Java doesn't work on the web, and GWT has sufficient issues to prevent serious use. Maybe that's not totally fair. To work with GWT, you will always end up writing JavaScript again, except now you have to put hacky JavaScript in with clean Java; Not an elegant solution.

Flash is a good solution for most Business-to-Customer implementations, in that AJAX type developers will get used to Flash's ActionScript syntax quickly. In fact, ActionScript 3 is so much like Java that it seems to be the language that JavaScript should have always been.

All that being said, I'll enumerate, yet again the problems with Flash. First, technically, Flash still needs to be compiled which slows development time. Flex helps with this in that the compile step is done dynamically, ala JSPs, but it is still annoying. Many of the Flex components are still too heavy, they take too long to download. Again, to make heavy changes to the Flex, you have to leave the nice tidy world of MXML and enter the world of ActionScript 3. The idea was supposed to be that non-flash developers could actually use Flex, only knowing Flex to develop rich web applications. Nobody wants to use two or three languages to develop a single application. One of the things that most people hate about JavaScript, CSS, and HTML is the box model, but I'd argue that while it is annoying, with Flash and Flex, you have no automatic formatting of pages, allowing developers to make hideously ugly interfaces with no consistent whitespace whatsoever. Sure it takes lots of knowledge to build good web applications, but what's wrong with that. When was the last time you saw a newbie write a Struts web application using EJB? There is a reason 2/3rds of sites out there use PHP.

Yet another resons Flash is difficult is that in order to work with it you must use the Flash authoring tool. Flex helps in that you can use their Eclipse based tool, but to really get into the nitty gritty, you need Flash and it costs money.

The Flash compiler is not separate so you can't write nice scripts to build your application for you, if you decided not to go with Flex for flexibility reasons. This makes it exceedingly hard to use other tools to write your ActionScript. Adobe could have made the Flash IDE open source years ago and they still refuse. I can write AJAX applications with text pad, and use any scripting system to deploy that I want to.

Basically there are two reasons why AJAX is the current technology of choice for rich applications, not one. The first is what the author of the article above claims that no installation is needed for the user. But the second is that development is infinitely flexible. A developer can write JavaScript, CSS, and HTML anywhere, anyway they want, and if they have access to some file transfer protocol, they can upload their changes and see them immediately.

The author would like for everyone to think that the only solution is Flash, but it is highly possible for FireFox's plugin language based on ECMAScript and ActionScript ( Adobe gave them a bunch of the code for the Flash VM ) will be the rich application development language of the future. In other words, what the Mozilla foundation has been doing is they have been cleaning up, and extending JavaScript to control more of the browser. Also, the installation of these plugins is incredibly simple. As easy as installing the Flash player.

Another point is in business-to-business applications. Flash fails in this capacity because if you are a non-administrator running IE, it is difficult to install the Flash player. What is worse, you will visit a site, it will prompt you to upgrade, but when you try you will be told that you don't have permission to perform the operation. So whatever you are trying to do will either half work, or not work at all. There are departments who have only chosen, say Flash 7, as the plugin that they mirror, so all those advanced features of Flash 9 will be lost on the users, and they can't upgrade. Imagine sending one of your employees to a web application that they can't use and telling them to get their job done. It just doesn't work.

Back to AJAX, even if a company turns off XHR (XmlHttpRequest), I can still make my applications work with their full feature set using iframes. Most of the people who complain that CSS, HTML, and JavaScript solutions are too complicated, and champion using Java or some other strongly typed OO language have obviously forgotten how hard it was to learn Java. In a lot of ways Flash is worse, it has gotten better, but it was originally a design tool, not a programming tool, and in many ways it still reflects that.

I'm not claiming that the tools and techniques that comprise AJAX are the end-all-be-all of web development. But what I am claiming is that even with all their shortcomings they are still the best of what's around. That is clear by the amount of interest out there in it. It is easy to deploy, easy for the user to work with, easy to develop, infinitely flexible, and ubiquitous. Now what's wrong with that?