javascript-the-good-parts

A while back, a book entitled JavaScript: The Good Parts made waves on the internet, especially social networking sites. This book purported to show the inner beauty of a language that was long considered second or third rate, coming of age. With the advent of toolkits like JQuery, Javascript/AJAX development has become easy and even fun.

I aim to do the same by showing "Java: The Good Parts" here at a high level.

java_powered_logo_rgb

When I was younger, I used to despise Java for political reasons and bad memories of early applets and applications. I suspect many users and developers (especially Libre software devs!) are on the same boat. By the end of this article, I hope I swayed your opinion or at least caused you to reevaluate your bias. I also wish to encourage further discussion about these points and ways we can improve any deficiencies.

Rough and Tumble Upbringing

When Java first started gaining popularity, it was loudly hyped as the end all language. It was expected that Java would take the "rich client" by storm, and applets would be the go to solution for enhancing web pages. What happened was a bit different. Java floundered and struggled to find a niche. On the client side, AWT apps looked horrendous despite using native widgets. Then Swing came about and despite easing development, it looked equally bad on all platforms (by default). Applets were basically a stillbirth. The ugly gray box, loadtime sometime measuring in minutes, and no coordination with the DOM and web browser made the average user hate Java.

One area Java was able to develop and secure a foundation, however, was the back end of large web applications. The Virtual Machine approach provided a marked advantage over the CGI and interpreted scripts of the day. Java's rich networking libraries, clean Object Oriented design, and safety made this the language de jour for large web applications.

Open Source Matters

In my opinion, the open sourcing of Java during its early infancy would have had little impact on most of the teething issues. The Virtual Machine, JIT, and Garbage Collection required many years of tuning to get acceptable performance and Sun did an acceptable job keeping it under wing. The relatively limited CPU and RAM of the mid '90s also made these concepts a bit ahead of their time. Somewhere in the 1999-2002 time frame, though, Sun really dropped the ball. An Open Source Java would have led to ubiquity on the booming Linux platform and a chance for all sorts of cross-platform software.

Open Source matters, and not just for the source code. Open Source projects naturally bring about very pragmatic and intelligent developers. These are the folks that thoroughly enjoy their hobby, work, and tools. The marketing guys and pointed haired bosses have much less pull here. On one hand, a vibrant community built itself with the many Apache Software Foundation projects. However, most of these were squarely focused on web applications or low level things such as build tools, testing frameworks, and message buses.

ThumbsUp

Due to the void, interpreted languages such as Python rose to the challenge while C and C++ remained the mainstay for applications programming. Microsoft started dominating Windows development with their .NET CLR languages. The glib/Gtk+ and Qt toolkits brought about a renaissance in cross-platform development with C and C++ respectively [though not limited].

It wasn't until the open-sourcing of SWT that GUI development in Java became attractive. The obvious killer apps here were the Eclipse IDE and the Azureus (now Vuze) bittorrent client.

Sun's closed grip of Java really stagnated any chance of abundant expansion in these middle years (2001-2006). Microsoft leveraged this weakness to create the excellent .NET platform and associated languages to maintain their closed platform and market dominance. The counterbalance that would have been Java was thus left playing catchup.

We are just beginning to see the fruits of this labor from 2006 through today. The OpenJDK project is now distributed with popular Linux distributions such as Ubuntu and Fedora. We finally have decent browser plugins and Java Web Start applications across 32 and 64-bit machines. The Java deployment problem will slowly fade from memory.

Application Development

SWT made Java apps beautiful. OpenJDK should make them ubiquitous. We finally have an Open Source platform that is widely deployed. The strong built in standard library and clean OO design patterns of Java make it a very pleasant host for developing rich client apps. Obvious areas for improvement here include better layout/form design tools and closer integration with upstream Linux distributors.

qt-logo

Somewhere along the line, Trolltech/QT Software (now owned by Nokia) released Jambi -- the complete Qt bindings, GUI framework, and incredibly rich library -- for Java. Oddly, this bombshell received little of the community and fanfare I thought it would or deserves. Indeed, QT Software demoted Jambi from their teir-1 platforms and hopes the community will pick it up. I hope this project isn't allowed to stagnate as there is a lot of potential here.

Web Apps

Along the "Enterprise Web Application" lineage of Java, we wound up with some disgustingly overcomplicated and bloated frameworks for building web apps. Ruby on Rails and Python Django came about and put a new spin on the development of rapid and robust web apps. The learning curve of these frameworks is much less than Java EE and I will go as far as saying they are more capable because of it.

By using Java, JSP, and Servlets directly on top of a light Model-View-Controller, I believe Java is just as compelling as some of the more popular scripting languages. Developers need to know they can trim the fat and that there are many advantages to developing in Java, namely because of the next topic...

Dynamic Languages, its all about the VM

It's all about the JVM stupid! One of the best features of Java and .NET are the underlying Virtual Machines. By using JIT compiled VMs, Java code has a distinct advantage over the common interpreted languages such as Perl, Python, and PHP. In the case of Java, the resultant is even naturally crossplatform.

The really interesting developments here focus on extending the JVM to syntax and paradigms other than the statically typed C++ lookalike. Clojure and Scala deliver innovative new techniques while Jython and JRuby bring these excellent languages to the Java software platform and virtual machine.

In short, Java provides everyone with a counter to Microsoft's .NET CLR. The Java VM has been around the block and tuned by giants such as Sun, IBM, Oracle, SAP and more.

I call on the community to discuss how we can encourage use of the JVM for languages other than Java and build this into a defacto runtime. Continued tuning and integration with Windows, Mac OS X, and Gnome/KDE *NIX systems is paramount. Research for easy multi-core development is also worthwhile. Meanwhile, distributions need to continue packaging the JRE and make it a default. Individual developers need to be made aware of "Java: The Good Parts" and myths debunked.

Applets, Rich Media, Native Code!?

javafx_logo

With the release of Java FX, widespread deployment of the JRE, and better browser integration, Java has set the stage for a comeback to its roots.

During the late '90s and 2000s, Adobe Flash became the tool of choice for web animation and interactive pages. It really exploded with the advent of Youtube and other internet streaming sites making use of the Flash video format. Unfortunately, Flash player is notoriously insecure, resource intensive, and crash-prone. It is also not widely available for the millions of smartphones that have become more accessible than computers.

Luckily, there seems to be a shift back to the browser with new developments in AJAX, JavaScript, and HTML. The \<video> tag will hopefully make video as easy and portable as graphics are today in the browser. Clean JavaScript libraries and fast JIT JS engines make it practical to use this paradigm for many domains.

Yet one must acknowledge that somewhere along the line, manipulating a DOM/markup language with a scripting language isn't the most effective development platform for everything. Google even thinks it poignant to run x86 machine code in a sandboxed environment in your browser. I personally fail to see the logic behind this. Java provides a well evolved, cross-platform solution. Java can run on your ARM powered Android. Requiring an x86 CPU just seems like the wrong track in this modern age. Hopefully JavaFX will pick up the slack and return Java to its roots. I would love to see the demise of the terrible Flash plugin.

Future and Conclusion

It's time we considered Java for The Good Parts.

I hope some of my points caused you to reevaluate any bad preconceptions or past experiences you may have had with Java. Java has undergone great change since its birth and I think it is capable of becoming the premier development platform for applications programming of all types. Particularly interesting are some of the new languages such as Scala and Clojure. Java has long been a staple in web development, but has traditionally scared away amateur coders. If you cut the fat, Servlets and JSP are not much harder to set up than common place scripting languages. Frameworks such as Grails bring it to parity with Rails or Django.

Java underwent a sea change in 2006 with the releasing of the source code and opening of the development process. Java and the JVM should be championed by Libre software developers and users alike!


Comments

comments powered by Disqus