Top five scripting languages on the JVM

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

Page 4 of 6

Niche languages
The following three languages are not as established as Groovy and JRuby, but they have the elements that could bring them success in the next few years. Even if they don't reach that level, they have enthusiastic supporters who are likely to keep the languages alive in diverse programming niches.

JVM scripting language No. 3: Scala -- fast, multiparadigm programming
Scala (pronounced "scah-lah") was originally developed as a research language in 2003. It is often described as a multiparadigm language because it combines elements from different programming philosophies. At its core it is a pure object-oriented language (that is, everything is an object) with functional capabilities. Functional, in this context, refers to a programming style popular in academia that favors the use of functions with no side effects (functions that do not alter the state of variables or other functions), the use of first-class functions (functions become objects that can be passed to other functions), and to the extent possible, the use of constants over variables. The last preference might sound peculiar, but it's already found in many languages, including Java. For example, strings in Java cannot be modified. Any attempt to change an existing string results in the creation of a completely new string.

Functional programming has been a favorite area of research, and Scala might be a vehicle by which it enters the mainstream. Its big advantage over traditional programming approaches is that it greatly facilitates parallel programming -- the ability to have multiple portions of a program executing simultaneously. As multiple cores become the norm in modern processors, parallel programming represents an excellent way of exploiting the full capabilities of the hardware. To this end, Scala is unique among the languages for the JVM in having actors -- another parallel programming construct -- built into the language. (Fantom has actors as an add-on. The difference is small, but important for some developers.)

Scala enjoys a singular advantage over the other languages reviewed here: performance. The language is compiled to optimized bytecode and runs essentially as fast as native Java. The remaining languages are either somewhat or very far behind Scala in execution speed.

Scala does have shortcomings, however. The first of these is sometimes opaque syntax. Every language can be used to generate impenetrable code, but it is easier to do so in Scala. The second problem is one of binary compatibility. The maintainers of Scala have several times released new versions that are not binary compatible with previous versions. This is a huge obstacle to widespread adoption, certainly among enterprise developers, who will find no enjoyment in recompiling existing code to be able to work with more recent code. Nonetheless, good tools for Scala have emerged, and the community of users is active and enthusiastic. I fully expect Scala to be in the top tier of JVM languages within a couple of years.

JVM scripting language No. 4: Fantom -- Java and .Net plus performance
Fantom (formerly called Fan) is unique among the languages discussed here in that it generates bytecode at runtime for either the JVM or Microsoft's .Net platform. The language is object-oriented with many of the same features described previously for Groovy and JRuby, except that integration with the Java libraries is not as seamless: A special interface is required to interact with existing Java bytecode. Fantom makes up for this shortcoming in part by having extensive libraries of its own.

| 1 2 3 4 5 6 Page 4
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