We've got to maintain a certain level of 'street-cred'.

A Look at Java Virtual Machine (JVM) Languages

We admit that this blog has been stuck on the Java Virtual Machine (JVM) lately. There actually happens to be quite a lot to discuss, however. The Java ecosystem has branched and the popularity of the system has led to much more than just the core language and the Java EE framework. This may be because of the fact that the JVM is a nicely-optimized environment, built more with native performance goals in mind than some other interpreters. It also owes to the ubiquity of the runtime. For these and other reasons many languages that run on top of the JVM have risen.

JRuby

JRuby is part of the trend of bringing other high-level languages to the JVM, similar to Jython and Clojure. Ruby itself is immensely popular thanks to its extremely clean interface and the Ruby on Rails platform. JRuby started out as a direct C port of Ruby but has now become something all its own. The major benefit of the language is the ability to call JRuby from Java, or to call Java from JRuby, adding flexibility to both programming environments.

Scala

Scala, unlike JRuby, was built from the ground up to be a JVM language. It was consciously named to imply “scalability,” and it can be thought of as cleaner, more scalable extension of Java. It is a full object-functional language. It has the majority of features of a Lisp dialect such as Clojure, but it maintains a great deal of the “curly-brace” style of its parent language.

Clojure

We’ve discussed Clojure on this blog before, and pretty much should disclose our bias since we use it. However, no examination of JVM languages is complete without it.

One of the best recent discussions of Clojure (and other languages) stems from this blog posted by Adam Bard. This analysis of the same web project in PHP, Python, Ruby, and Clojure gives a good opportunity to compare and contrast these different approaches. While the choice of languages has much to do with comfort levels, legacy tech, and customer needs, here are the advantages that this article illustrates about Clojure:

  • Clean interface
  • It does not take too much effort to create the presentation code, while the other languages must depend upon microframeworks
  • The code should run faster than with any comparable platform (though admittedly no benchmarks are provided)
  • The entire project can fit in one file and run on any JVM

In our own experience the benchmarks from TechEmpower's Fortunes tests show relative performance well (Clojure is represented by the Compojure framework). Of course, the one major downside is that not all developers are comfortable with Lisp dialects. However, those that are can leverage the language for quite a lot of power, and couple it with all of the utility of the JVM.

Conclusion

Whichever JVM language that a developer decides to put on his or her toolbelt is a matter of personal taste and practical considerations. However, it is a good idea to explore one of these languages and take a look outside of the Perl/PHP/Python/Ruby paradigm. The JVM is everywhere, and the ability to leverage one runtime for a multitude of languages may make this the wave of the future.