The JVM's ability to support multiple languages is a facet that has only relatively recently received much emphasis from Sun. The change reflects the changing tastes amongst the broad spectrum of developers who target the JVM, some of whom are looking to dynamic languages to speed up parts of their development process. Through the inclusion of JSR 223 (Scripting for the Java Platform) Sun began to formalise the change, ensuring that Java SE 6 is able to execute scripting language code written in dynamic languages, such as Ruby, Python, Groovy, or JavaScript.
Travis Jensen, a technical architect at SirsiDynix, recently carried out a comparison of Groovy, Jython and JRuby looking at the three languages' suitability as the language for web GUI development by an existing team of Java developers. His assessment compares the languages against five broad criteria:
1. The interaction between the dynamic language and Java. Jensen felt that Groovy came out strongest with Jython close behind:
"Because Groovy supports applying types, overriding class methods is clean. Instantiating a Groovy class is the same as instantiating a Java class."He sees JRuby as presenting the most challenges:
"Going from Java to JRuby is not trivial, even though JRuby compiles down to a class. The compiler seems to be primarily for faster JRuby-to-JRuby interaction."
2. IDE support. SirsiDynix have standarised on JetBrains' IDEA which limits this part of the assessment - NetBeans' JRuby plugin, for example, was not covered. Jensen felt that the Groovy support in IDEA made Groovy a clear winner.
3. The learning curve for existing Java developers. Once again Groovy came out on top in Jensen's assessment:
"As a super-set of Java, it has a very straight-forward learning curve from Java. This is especially important around the APIs, since it uses the Java APIs directly. I honestly don't know whether the top-line productivity is as high as Python and Ruby, but I don't have any evidence that it is not. My gut feel is that the Python and Ruby libraries are optimized more towards their languages and will give a higher top-line."He also argues that JRuby, despite being regarded as a highly productive language, offers the most challenges for a Java developer:
"Given its closer functional ties, the learning curve for Ruby is highest of the three. It also has the same issues around the Java and native libraries. I honestly think that, once the curve is passed, JRuby could offer the most productivity. I've been nothing but impressed by what I've read about Ruby in that regard."
4. Available web frameworks. A strong vote for JRuby:
"With its direct port of Rails, JRuby seems to come out on top here."Jython is considered the weakest of the three:
"While CPython has some great options, Jython went nowhere for two years. The main cause of this is two-fold: Jython's current version is 2.2.1, whereas CPython is 2.5 and so many frameworks require compiled C code for performance."
5. Community support: Jensen feels that all three languages enjoy excellent community support but that Groovy has a slight edge:
"As the JVM is the only target for Groovy, the entire Groovy community is the JVM community. This obviously has some significant advantages for people looking to deploy on the JVM. It also seems to be picking up a lot of mind-share as the defacto 'Java Scripting Language', which is helping that community."
Of course any such assessment is to some extent subjective. It is also very much fixed in time - for example the increased activity around Jython, further bolstered by Sun's recent hiring of Frank Wierzbicki and Ted Leung to their team, should improve Jython's web framework status in future. Jensen's post does though provide a useful starting point and set of base criteria for architects or developers facing a similar decision.