Monday, May 2, 2011

Can the Java Applet Be Salvaged?

Most people view Java as the programming language of the Web. Though Java certainly serves well in this regard, it is actually much more general; it is appropriate for stand-alone, non-Web programming as well.

The above quotation seems funny today, but it was a relatively accurate representation of the perception of Java at that time. Many people did see Java as "the programming language of the Web" and many people did not realize that it was even possible to use Java outside of a web browser. In other words, Java Applets were well known and Java applications were not so well known.

In an early 1996 JavaWorld article called Introduction to Java (in plain English) (originally called "Waiter! What is this Java doing in my soup?"), Frank D. Greco wrote "...the way cool Java programming language is muscling its way onto the Internet with powers beyond those of mortal computer languages" and added that Java was, "flying on the vapor trails of the booming World Wide Web (WWW) service across the ubiquitous Internet." Greco's article talks about using Java for applications and for applets, but it is obvious that applets were still a huge part of the Java discussion at this time.

As a largely unrelated but interesting side note, Greco also wrote:

Since the Java runtime system is actually independent from the Java source language that a programmer would create, other languages and other tools could potentially generate the machine-independent Java bytecodes. There's nothing to stop someone from creating a version of BASIC that generates Java bytecodes; and it would be 100 percent compatible with bytecodes generated by the standard Java translator.

Although I don't know of any flavor of Basic running on the JVM, just about every other imaginable language seems to be running on the JVM these days in addition to entirely new languages written for the JVM. Fifteen years ago, applets were everything and alternative languages on the JVM were mostly conceptual.

While Java applets are no longer as popular as they used to be, I still think of them fondly since they introduced me and many others to Java and to the idea of more elegant solutions than CGI for web development.

By 2002, it already looked like applets were on their way to "has been" status.

"Applets are back!" was the beginning line of Next Generation in Applet Java Plug-in Technology, published in June 2008 in conjunction with the release of Java SE 6 Update 10. This "next generation Java Plug-in" was advertised with features addressing many of the common complaints about applets. These advertised features included "improved reliability," "improved user experience," and improved integration with JavaScript (another historical side note is the reversal of roles between Java and JavaScript when it comes to the web).

The driving force behind the renewed applet in Java SE 6 Update 10 was JavaFX. Sun's (and more recently Oracle's) enthusiasm regarding JavaFX has not seemed to be matched by the general Java development community's enthusiasm. Indeed, there seems to be a chasm between Java developers regarding JavaFX with the majority of developers seemingly against it, but a smaller group enthusiastically supporting it as a competitor in the RIA space. I don't know if it is the next generation Java plug-in's association with JavaFX or the fact that it received too little attention too late or both of these factors, but the applet still has not seemed to regain any lost ground.

Jeff Friesen wrote a JavaWorld article called "Are applets making a comeback?" in May 2008 (about the same time as the release of the next generation Java Plug-in in conjunction with Java SE 6 Update 10). He stated the following in that article:

These days applets have largely been forgotten by Java developers working in the RIA (rich Internet application) space. ... Talk to Sun engineers working on Sun's consumer and client-side initiatives, though, and ... they'll tell you that news of the demise of applets is premature. ... The question for many of us is whether it's just too late for applets. ... The problem is that most Java developers have already given up on Java on the client side, and bought into the promise of slicker technologies that caught that wave when it was coming in, rather than chasing it, as Sun seems to be doing today.

The above quote was published nearly three years ago. I don't believe that things have improved much since then for applets. In that same article, Friesen "posed a series of questions to some of the most respected thinkers in the Java developer community" in an effort "to investigate the potential of Java on the client side, and of an applet comeback." The responses of these "most respected thinkers" (Danny Coward, Romain Guy, Chet Haase, Cay Horstmann, Ted Neward, Jim Weaver, and John Zukowski) were very interesting at that time, but I'd love to hear how or if their respective responses would be different now about the future of Java applets.

Until Oracle states that support for the applet will be discontinued, there's always a glimmer of hope regarding the applet's future. However, if I was coerced into betting on the outcome, I could not in good conscience place my bet on the applet returning to its former glory. At this point, the Java applet has to fight a force potentially more powerful than any other: negative perceptions earned from truly negative experiences and perpetuated in discussions, blog posts, articles, and other modern forms of communication. It was difficult for the Java language to escape the "Java is slow" mantra that was once very true, but quickly improved (it's not as fast relatively as some languages, but is much faster than some of today's most trendy languages, and performance does depend on what's being done). The applet did not enjoy such rapid reaction to its complaints and now the hole that has been dug may be too deep to come out of.

7 comments:

I think the fundamental design of Java applets is one reason for their downfall. They don't integrate well with a webpage, compared with JavaScript + DOM. They also were (and still are) actually quite slow to load. I think it's because the JVM is still too heavyweight for this space. But, that's my 2c.

The first part is quite true late 90 was mostly days of applet , when Java rule the web and applet was first choice for any dynamic programming but with moving years java lost that plot and gain some other landscape like servlet, MIDlet etc but the real power of Java is public static void main(String args[]) i.e. standalone java program , just my thought.

The author mentions that he is unaware of a BASIC language tool that runs on the JVM. There is one - it's called JABACO. It is a very faithful clone of VB6 and produces Java applets that work quite well.