You’re in for a treat. One of the most prominent and widely used languages
in the world has evolved, for the better. Until now Java gave us one set of
tools—OO—and we did the best we could with it. Now, in addition, there’s
another way to solve more elegantly the common problems we encounter
when developing applications. We can now do quite effectively in Java what
was possible on the JVM only using other languages—this means truly more
power for everyone using Java.
In the past few decades, I’m thankful for the privilege to program with a few
languages: C, C++, Java, C#, F#, Ruby, Groovy, Scala, Clojure, Erlang,
has been: it’s not the language that excites me, but the way we program.
The science and engineering in programming is what drew me in, but it’s the
art in programming that keeps me. Coding has a lot in common with writing
—there’s more than one way to express our ideas. Java helped us so far to
write code using objects. Now we have an additional way to implement our
designs and ideas.
This is a new way in Java, one that will make our code more expressive,
easier to write, less error-prone, and easier to parallelize than we were able
to do with Java until now. This way has been around for decades and widely
used in languages like Lisp, Clojure, Erlang, Scala, Groovy, Ruby… This is
not only a new way in Java, but you’ll find it to be a better way as well.
Since coding is like writing, we can learn a few things from that field. William
Zinsser recommends simplicity, clarity, and brevity in On Writing Well [Zin01].
To create better applications, we can start by making the code simpler,
clearer, and concise. The new style of programming in Java provides exactly
that, as we will explore throughout this book.