Skip to content

JVM based languages

Gabor Szarnyas edited this page Nov 19, 2016 · 10 revisions

Besides Java, there are dozens of languages that run on the JVM.

As a general rule of thumb, these languages will provide some syntactic sugar over Java (especially compared to Java 7), which allows you to write the same programs with fewer lines of code. They also provide interoperability to exitings Java sources and binaries.

However, be careful with these languages as they have some tradeoffs:

  • They are often difficult to integrate in the build process.
  • Their editor support is often less polished than Java editors: the editors are often sluggish, display incorrect errors (which may or may not disappear after a clean & build).
  • If someone else has to maintain your code, she can probably read/write Java code, but will not necessarily be able to comprehend your code.
  • Even if you are the only one working on the project, getting help will be significantly more difficult, especially if you run into a bug in the compiler.
feature Java 7 Java 8 Groovy Kotlin Scala Xtend
StackOverflow tag java-7 java-8 groovy kotlin scala xtend
lambda expressions
data classes
reified generics
list comprehensions
traits
string interpolation
extension methods
extension providers
dispatch methods
null safety
async/await 1.1+
pattern matching
coroutines 1.1+
default parameters

Primary use cases

Groovy:

  • Gradle build configuration.
  • Scripts. If it gets too complicated (more than a couple of hundred lines), I'd rewrite it in another language.

Kotlin:

  • Rapid prototyping.
  • Android applications.

Scala:

  • Data-intensive applications.
  • In general, using Scala libraries (e.g. Akka) is much more convenient from Scala.

Xtend:

  • Manipulation of EMF models.
    • In particular, processing Xtext models.
  • Code generators.
Clone this wiki locally