Dynamic languages are good for solving problems where the answer is not necessarily known when starting out, such as in building Web applications, especially because there is no one "right" way to build a Web application, says Clojure author Rich Hickey. By contrast, Java is a good language for implementing another version of a solved problem; lower-level infrastructure apps are particularly suitable for Java, he notes.
Several languages bring better capabilities to the JVM
JRuby and Jython proponents call their languages a supplement to Java, not a competitor. "Jython is much more of a supplement to Java on the JVM," says Frank Wierzbicki, a Jython project lead. "JRuby is definitely a supplement. It is something you can use instead of Java when the situation is right for that. JRuby enhances the Java platform by bringing Ruby to it," says Ola Bini, a JRuby core developer.
JRuby. JRuby has been the arguably most visible of the dynamic languages riding on the JVM lately. It dates back to 2001 and is an implementation of the Ruby language. "Having Ruby on the JVM is important for two reasons. First, it gives Java developers access to a programming language that is higher-level," Bini says. Second, "Ruby [has] lots of interesting libraries such as Rails and RSpec that can be used on top of the JVM. Being on the JVM also means that when using Ruby you still have access to all the existing Java libraries. JRuby can use any Java class as if it was a Ruby class. This means you get the combined power of both the Ruby language and ecosystem and the Java environment," he says.
Jython. Meanwhile, Jython goes all the way back to July 1998 when it was called JPython, Wierzbicki notes. "There is a vast amount of Java out there, and Jython provides a way to access that code from the highly productive Python language," he says. For example, Jython has been used by testing frameworks as an embedded scripting tool.
"I've spoken at many Python conferences like PyCon, EuroPycon, and EuroDjangoCon and I have found that many in the Python community really want to be able to use Python on the JVM," he adds.
Clojure. Also atop the JVM is Clojure (pronounced "closure"), developed to support functional style and better concurrent programming on the JVM, says Hickey. It is leveraged for multithreaded application development. "The intent of Clojure is to be useful wherever Java is useful," Hickey notes -- thus its use of Java libraries and a syntax to support Java calls transparently.
Scala. Debuting in 2004 and boasting Twitter and LinkedIn as users, Scala arose out of Odersky's desire to improve on Java. While the Java platform has offered capabilities such as type safety and garbage collection for object disposal, more was needed, he says. "We wanted to make Java more expressive, so people could be more productive" and write at a higher level of abstraction with fewer lines of code, Odersky says. Scala differs from other JVM-compatible languages such as JRuby, Jython, and Clojure in that it deploys a refined static type system and offers more expressive programming, he says.
Groovy. Another language for the JVM is Groovy, which has a mixed reputation among developers. Billed as "an agile dynamic language for the JVM," Groovy builds on Java strengths while also offering features inspired by languages such as Ruby and SmallTalk, says the Groovy Web page on Codehaus.
"It's definitely easier to program," with Groovy than Java, says Jon Travis, principal software engineer at SpringSource, which oversees development of the Groovy language. "Groovy all around adds a lot of expressiveness for people who are very familiar with Java," he notes.
PHP so far not catching on among JVM developers
While Ruby and Python implementations have gained a foothold on the JVM, the same oddly is not true for the popular PHP language, says Sun's Bray. "The No. 1 candidate that people are working [on] but isn't really there yet in terms of widespread adoption is PHP," he notes.