X
Tech

Is Flash better than Java?

Over the past few years alternatives to Java in and around the browser have been gaining traction, especially Macromedia Flash. Using Flex and ActionScript, you can write sophisticated browser-hosted or desktop interactive business applications. So is it time to toss out your webtop Java code?
Written by Ed Burnette, Contributor

For various reasons, Java applets have never worked all that well but we some folks use them anyway, for example in business charting and other graphic visualizations. Over the past few years alternatives to Java in and around the browser have been gaining traction, especially Flash. In this article I will argue that it's time for Java to take a lesson from its competitors (on the client side) and address some of the shortcomings that are allowing them to flourish.

Flash
The most serious competition for webtop Java is Macromedia Flash. Flash started life as a very small footprint (~180K) media plug-in for Internet Explorer and Netscape.Flash should light a fire under the Java community Adobe acquired Macromedia a few years ago, and has been pouring resources and marketing into it. Now, Flash 9 is an advanced development platform. Through Flex and ActionScript, you can write sophisticated browser-hosted interactive business applications. The run-time is still relatively small (much smaller than Sun's Java, about 1MB), it's frequently updated with "frictionless" installs, supports vector graphics, streaming video, Ajax-y back-end interaction, and many other features that users find appealing.

Flash Lite is extending the Flash ecosystem to mobile devices. What was previously the domain of J2ME (now called Java Micro Edition or Java ME) is now being Flash-enabled. Because Flash is vector-based, applications are easier to port from one screen size to another, and users don't see jaggies because Flash has always done anti-aliasing. When I read this article from Adobe it really made me think. Even if you don't do anything with J2ME, Flash Lite is draining more mind-share away from Java.

Adobe Apollo brings Flash to desktop applications, in direct competition with Java Swing and Rich Client Platforms. It holds an attractive promise of being able to share code between browser-based, mobile-based, and desktop-based applications. Well, hasn't Java been doing the same thing for 10 years? Yes, but its execution has been flawed in many ways.

Analysis
Ok, so what does all this mean for developers? The software industry has a tremendous investment in Java code, millions of lines and billions of dollars. We don't want to move to another language like ActionScript just for the fun of it, right? If there was a good enough reason, then it could be justified. I'm all in favor of new ideas and moving to better, more efficient technologies. In fact I've used that argument more than once to move C code to Java or C#. But recoding from Java to ActionScript? There's no way that qualifies. IMHO, there's no technical reason that Java can't do everything that Flash can do, with a little work.

The most serious problem that has allowed alternatives to flourish is the poor Java applet user experience. What if we could toss that out and replace it with something better?

I'm talking about work to make Flash-like small footprint installs of a Java-based run-time. Instant-on and streaming compressed content (no more Java progress bars). Frequent updates, fully backward compatible (no content left behind). Viewer-like security with no scary prompts for the user but no complicated signing either. And so forth. I'm sure you all have lots of ideas about this too.

What about F3?
Some have suggested that the new F3 language is Java's "Flash killer". F3 is an experimental declarative scripting language with static typing, type-inference, declarative syntax, data-binding, 2d graphics, declarative anmiation, and more. It demonstrates that the Java platform is highly competitive with competing platforms such as Flash. But F3 is a different language from Java. I'm talking about using Java code that already exists. Also I haven't seen any demos of F3 running inside the browser, only through Java WebStart (.jnlp). F3 doesn't address the underlying problems with applets and Java installs that Flash addresses. It can't be a Flash killer until its user experience is as good as or better than Flash.

Conclusion
For years the industry has waited for Sun to solve this problem and they haven't. Now, with Java 7 being open source, we could do something about it ourselves. Java experts could work together to build an open community around a new Java-based viewer (which we might not even want to call "Java"), and reverse the brain-drain away from Java technologies, preserving our investment in Java code and expertise.

Is Flash better than Java? No, just far better executed for some important use cases. Failing to address this, and allowing Flash and other alternatives to continue to grow and improve unchecked, is going to lead to competitive disadvantages or needless conversions down the road for Java developers. Instead of participating in endless arguments about esoteric subjects like closures and native code, competition from Flash should light a fire under the Java community and force it to respond with radically better user-facing solutions.

Editorial standards