Chapter 7. Alternative JVM languages

 

This chapter covers

  • Why you should use alternative JVM languages
  • Language types
  • Selection criteria for alternative languages
  • How the JVM handles alternative languages

If you’ve used Java for any sizable amount of work, you’ve probably noticed that it tends toward being a bit verbose and clumsy at times. You may even have found yourself wishing that things were different—easier somehow.

Fortunately, as you’ve seen in the last few chapters, the JVM is awesome! So awesome, in fact, that it provides a natural home for programming languages other than Java. In this chapter, we’ll show you why and how you might want to start mixing another JVM programming language into your project.

In this chapter, we’ll cover ways of describing the different language types (such as static versus dynamic), why you might want to use alternative languages, and what criteria to look for in choosing them. You’ll also be introduced to the three languages (Groovy, Scala, and Clojure) that we’ll cover in more depth throughout parts 3 and 4 of this book.

Before we get started on that, however, you might need more convincing about some of Java’s shortcomings. The next section is an extended example that highlights some annoyances, and points the way toward the programming language style called functional programming.

7.1. Java too clumsy? Them’s fighting words!

7.2. Language zoology

7.3. Polyglot programming on the JVM

7.4. How to choose a non-Java language for your project

7.5. How the JVM supports alternative languages

7.6. Summary