CHAPTER 1: Introducing Java Web Development 3
Imperative languages: These are languages in which the state can be mutated
by the instructions in the language.
Functional languages: In functional languages, the functions operate on values
as in procedural languages, but instead of mutating the state, the functions are
purely mathematical functions that return new values.
Figure 1-1 shows where Java 8, Groovy, Scala, and Clojure fall on the functional language
continuum. Java 8 introduces lambdas, which makes it slightly functional, Groovy has had functional
constructs since its inception and is even more functional with Groovy 2.0, and Scala is the most
functional of the three object-oriented (OO) languages. Clojure, on the other hand, is a purely
functional, non-OO language.
Figure 1-1. Functional gradation of JVM languages
Note In Figure 1-1, no version number is mentioned for Groovy, Scala, and Clojure because Java supports
aspects of functional programming starting from Java 8 only.
Languages Ported to the JVM
JRuby, Jython, and Rhino are a few of the mainstream JVM implementations of existing languages.
Table 1-2 describes them.