Where at the JavaOne conference does "www" stand for "world-wide wrestling?" In session PAN-5435, that's where -- the Script Bowl, where four Java-interactive languages tag-teamed in a heavyweight fight for audience mindshare. Cue the basso announcer: "This is judgment day for scripting languages!"
In the first corner: Groovy, first released in January 2007 as a dynamic scripting language for the Java platform. Groovy was represented in this event by Guillaume Laforge, VP of technology at G2One, Inc., and Groovy project manager.
In the second corner: JRuby, represented by Charles Nutter, Sun engineer and technical lead for JRuby. JRuby is the Java implementation of the Ruby scripting language, which was first released to the public in 1995.
In the third corner: Jython, a Java implementation of the Python programming language, first published in 1991. Jython was represented by Frank Wierzbicki, Sun engineer and technical lead for Jython.
In the fourth corner: Scala, a statically typed language that only feels like a scripting language because it has type inference and flexible syntax. It was first released running on the JVM in 2004. Scala seeks to integrate features of object-oriented and functional languages. Representing the language was Jorge Ortiz.
Each of these languages can be compiled to Java bytecode.
Host Raghavan "Rags" Srinivas, CTO of technology evangelism at Sun, posed three problems. Each language took a shot at solving them. For each round, the audience rated language performance by texting votes from their cell phones. Trying not to get hurt in the melee were referees Roberto "Scriptologist" Chinnici, Sun senior staff engineer; Carol "Blogs" McDonald, Sun Java evangelist; and Paul "Earthly Powers" Sandoz, Sun software engineer, who provided color commentary.
Round 1: Rich Client Application
In Round 1, the task was to code a simple, read-only Twitter client as a desktop application. The app was to prompt users for login credentials, and then let them browse for their Twitter friends while filtering content. Programmers used their own discretion about whether to use JSON or XML output from Twitter.
The Groovy entry showed a nice interface to a responsive application. The app easily parsed Twitter's XML code using Groovy's XML parsing support.
For the JRuby entry, Nutter solicited input from the JRuby community to produce his demos, and he showed two different approaches. The first, called "Twit Bucket" by its author, Tom Enebo, was described as a raw approach to writing Swing components directly. For composing the interface layout, Enebo used the Ruby Profligacy library to avoid Swing layout managers. The second JRuby approach used Monkeybars, as developed by David Koontz and others. Monkeybars allows you to use a standard GUI builder, and then wire in controller and model logic behind the scenes to handle events.The Jython implementation presented a less functional interface, but not because of language deficiencies. Building on an existing model, Wierzbicki wrote the application by downloading the Python-Twitter library and wrapping the model in a Swing interface. The search feature accepted regular expressions.
The Scala application presented by Ortiz had an interface only slightly more graceful than Wierzbicki's. Ortiz built the application by extending the SimpleGUIApplication object and using a Scala wrapper for the Swing library.
Round 2: Web Application
In Round 2, the task was to create a web app, backed by the "world" example database from MySQL. The app was to let users browse for country data, select a city, and display it on a map using a publicly available map widget.
And the winner is: JRuby, on the strength of two impressive demos. The first, coded by Nick Sieger, was a Twitter application with animated interface. The second, coded by Jeremy Ashkenas, was an interactive flocking animation called "A Face for Stephen Hawking."
Round 3: Open
In Round 3, each representative chose a concise example that showed the language's merits to best advantage. Scala showed off its concurrency capabilities with an application that searched and indexed RSS feeds concurrently using the actor library.
We Are the Champions, My Friends
And the winner is ... JRuby, by a nose over Groovy, likely because of the flashy Round 2 demos. Bringing up the rear was Jython.
But while fun, the entire exercise of course proved nothing whatsoever. Choosing a "best" language depends less on its capabilities than on what you are most comfortable with, and on its perceived longevity and maintainability. All four of these languages will be with us for a while, and any of them could be a good choice, depending on the problem you want to solve.
|