A rough guide to JVM languages

Java is as much about the JVM as it is the language.

O’Reilly is celebrating the release of Java 7, and our inaugural OSCON Java conference: July 25-27 in Portland, Ore.

The possibility of using alternative languages on the JVM has always been an appealing side story to Java. Jython and JRuby were early pioneers in implementing a dynamic language on top of a statically typed VM. Now that Java 7 directly includes support in the JVM for dynamic languages, the coexistence is official.

Pick any of the languages here and you can expect the support of the robust JVM threading and garbage collection, plus access to a broad array of application libraries.

Up and coming

Scala

The pragmatist among JVM languages, Scala is a general-purpose programming language. It was conceived and is generally viewed as a “better Java,” and of all alternative JVM languages has the best acceptance in an enterprise setting.

Scala combines the familiar feel of object-oriented Java with strong language support for concurrency, XML and functional programming features: many of the tools that contemporary complex and scalable systems require. Scala also takes a lot of the awkwardness out of Java code, through features such as type inference and traits.

Scala-related content at OSCON Java:

OSCON Java 2011, being held July 25-27 in Portland, Ore., is focused on open source technologies that make up the Java ecosystem. (This event is co-located with OSCON.)

Save 20% on registration with the code OS11RAD

Clojure

Clojure is a functional programming language based on Lisp. Through careful design, Clojure is simpler to read and use than Lisp, and it interacts cleanly with the Java world. Its functional nature makes programs very concise and composable.

In common with Scala, Clojure is designed with concurrency in mind. Its variables are immutable, and the use of software transactional memory and agents help manage shared mutable state in a more sustainable way than locking.

The experience of Clojure’s inventor Rich Hickey is reason enough alone to give it a whirl. I once happily spent an hour listening to him describe the design and implementation of sequences in the language.

A “Lisp that could,” Clojure is finding increasing (and surprising, to most observers) traction and acceptance. One contributing factor to this is an advanced build and package management infrastructure in leiningen and Clojars. Salesforce-owned hosted platform provider Heroku recently added Clojure as its third supported environment, following Ruby and Node/JavaScript.

A small but important omission from the Clojure ecosystem is a port of the book The Little Schemer.

Clojure-related content at OSCON Java:

Tried and tested

Groovy

A mashup of ideas from Python, Ruby and Smalltalk, Groovy gained early traction in the world of JVM languages, reaching its stable release in December 2007. Having been around a while, Groovy strongly acknowledges the Java world into which it was born, and is a good choice for Java developers wishing to use a more agile and dynamic language.

One of Groovy’s jewels is Grails, a high-productivity web development environment inspired by Ruby on Rails. The Groovy world has also spawned Gradle, a modern project automation system for Java and JVM languages, providing an alternative to the established Ant and Maven projects.

Groovy-related content at OSCON Java:

Rhino

Another veteran of the JVM language scene, Rhino is an implementation of the JavaScript programming language in Java. Part of the Mozilla project, it is typically used by developers to add user scriptability to their applications using JavaScript, though it is also used in situations where a system is predominantly implemented in JavaScript.

First released in 1999, Rhino has been around the block a few times. As a JavaScript engine, it is facing increasing competition from the C++-based V8, but retains the immense advantage of Java interoperability.

Remastered classics

Jython

A port of the Python language to the JVM, Jython offers some advantages over and above using Python, including Java’s multi-threading and the ability to statically compile into Java classes. As a Python terse object-oriented language, programmers can quickly prototype in Jython, creating hybrid Java-Jython systems. Jython also offers developers an alternative to Rhino’s JavaScript for embedding scriptability in their applications.

Jython also lets web developers bring popular Django web application framework into a Java setting.

JRuby

The Java implementation of Ruby is no second-class citizen. JRuby has been recorded as better performing than Ruby 1.8, and strives for C-Ruby compatibility. Users of JRuby can benefit from using the Ruby on Rails web framework, or add Ruby scriptability to their applications.

One appealing aspect of building a system in JRuby or Jython is that it gives developers the option of reimplementing performance-critical code in Java without having to switch platforms as a project matures. Twitter’s migration from Ruby to the JVM is a case in point.

JRuby-related content at OSCON Java:

The Wild West

The JVM remains a fertile ground for language experimentation, as several of the languages featured in OSCON’s Emerging Languages track demonstrate, including Seph and Gosu. As a platform, the JVM bootstraps language inventors and experimenters today much as lex and yacc did two decades ago. At OSCON Java, aspiring language creators should pop along to Charles Nutter’s JVM Bytecode for Dummies.


There’s still time left to register for OSCON Java. See you in Portland, 25-27 July!

Related:

tags: , , , , , , ,

Get the O’Reilly Programming Newsletter

Weekly insight from industry insiders. Plus exclusive content and offers.

  • dave

    FWIW, Scala has a scripting mode which allows the Scala example to be reduced to simply:

    println(“Hello, World!”)

  • http://www.NetRexx.org CVBruce

    I’d also like to add NetRexx. This language was just recently released by IBM as open source. It combines the simplicity of the Rexx language, with the power of Java.

    Hello World program in NetRexx.

    Say “Hello World!”

  • http://assuranceautomobileguide.com/ Auto

    Don’t forget Groovy++

  • http://choirarrangements.freeldssheetmusic.org roger

    mirah is an experimental one

  • drewp

    Hey, where’s http://fantom.org/ ? It has URI literals. URI LITERALS.

    It also has a compiler that targets JS (or JVM), some standard JSON support, actors, etc.

  • mikhailfranco

    And Erjang for Erlang on the JVM:

    http://github.com/trifork/erjang/wiki

    Mik

  • vangeir

    The way you group JVM languages into 3 groups of 2 makes it sound like 6 people carrying a coffin to its resting place.

  • https://code.google.com/p/genyris/ Bill Birch

    Please also remember Genyris, it has URI symbols and many other Semantic Web features.

  • duh

    folks, this is an ad for OSCON. OSCON doesn’t have talks on those languages, so they are not included.

  • http://robertlhamilton.com Robert L Hamilton, Engineer

    An interesting approach to JAVA is furnished by NetRexx. It scrunches down to JAVA. An example is in jEdit which has a NetRexx plugin. Try it out.

    Bob Hamilton

  • Nikah Sekeri

    nikah şekeri, Davetiye, nikah şekerleri, Handmade Davetiye, Bebek Şekeri, Çikolata, Kına , Sünnet Şekerleri, ucuz nikah şekerleri

    Nikah Sekeri