Top five scripting languages on the JVM

Groovy and JRuby lead a strong field, with Scala, Fantom, and Jython following behind

RELATED TOPICS
Page 2 of 6

JVM scripting language No. 1: Groovy -- Powerful, high-level, enterprise-friendly

Groovy is an object-oriented language that is compiled to bytecode. Its principal syntactical trait is its close similarity to Java, but with much of the clutter removed. Java developers can quickly come up to speed on Groovy, and in fact, the Groovy compiler happily accepts pure Java syntax, allowing Java developers to transition to a scripting language without having to learn an entirely new syntax.

One of the many aspects of Groovy that simplify the code is the use of type inference. This term refers to the ability of the language to infer the type of a variable without having to be told explicitly by the developer. For example, Groovy can examine a variable's initial use and determine that it's an integer, a string, or so on. Programmers are free to provide this information or simply let Groovy work it out.

Groovy was one of the first scripting languages to offer another feature, called closures, which Java developers unsuccessfully pressured Sun (and presumably now Oracle) to deliver. Closures enable developers to specify a small piece of code as a stand-alone entity and tack it on to other programming operations. This enables great concision in describing program function and, in other languages, can provide a means to create functions as objects that can be passed as parameters to other functions.

Groovy also provides high-level constructs for handling standard tasks such as string processing, consuming or generating XML, unit testing, and so on -- all of which can save developers significant time. In fact, one of the early use cases for Groovy took advantage of its high-level syntax and testing support to quickly knock out unit tests for Java code.

Groovy has a unique history that highlights some of the vicissitudes of the open source world. The project was started up in 2003. The founders subsequently moved on to other projects, and at various times disparaged their original creation. Even without them, though, there was enough interest for the community of contributors to keep Groovy moving forward. The project was then taken up in earnest by Guillaume Laforge, a developer from France, and under his leadership enjoyed a renaissance. A leading Web framework, Grails, was built using Groovy and eventually tool companies started supporting Groovy in their IDEs and other developer products.

Laforge and the developer of Grails, Graeme Rocher, now both work for SpringSource, a division of VMware. This corporate backing might suggest that Groovy's future is assured. But while the language's popularity is on the rise, it suffers from a long-standing weakness that is slowly being addressed: a slow runtime. Despite the JVM's optimized performance, several Groovy features exact a high cost. Various efforts are under way to substantially change these features or diminish their performance impact.

RELATED TOPICS
| 1 2 3 4 5 6 Page 2
From CIO: 8 Free Online Courses to Grow Your Tech Skills
View Comments
Join the discussion
Be the first to comment on this article. Our Commenting Policies