Modern Java in Action

March 15, 2019 | Download a PDF of this article

The new six-month cadence for Java releases has become a real quandary for the book industry. It takes more than six months to update a book, so if you’re originally targeting Java 11 in your new volume, by the time it comes out Java 12 will already be released—with Java 13 imminent. This book finds an innovative way to cover all the versions since Java 8 by referring to them as “Modern Java.” (The term modern was also used by the C++ community several years ago to refer to releases of C++ that enabled strong typing throughout. But use of the term there was political—an indication that you should abandon the former nonmodern ways of coding. Such is not the case here.)

This book is the sequel to the authors’ previous work, the well-regarded Java 8 in Action. Whereas that volume introduced lambdas and how they might be used for functional Java, this book more deeply embraces functional Java and shows how to use this flow style of programming beneficially. As you’d expect, the authors pay thorough attention—across more than 150 pages—to the effective use of lambdas and streams together, including coverage of refactoring, testing, and debugging lambdas as well as a systematic review of most of the major design patterns in which the implementations are performed using lambdas.

Any good work on functional programming in Java needs to treat reactive programming as well. Modern Java in Action is the first major book on Java to understand this. It digs into reactive development across 130 pages that are filled with numerous demonstrations of how to implement your own reactive programming with CompletableFuture—as well as how to do the same with the RxJava library. This functional/reactive approach is the core of the volume, although other post-Java 8 topics are covered as well: modules, improvements to the date and time library, using Optionals, and so on.

The authors are well-known experts (Urma has cowritten several articles in Java Magazine), and their style is engaging and lucid. Their illustrations are deep and avoid snippet-size examples by exploring larger projects, such as writing a DSL or creating an asynchronous API and pipelining its actions.

This book bears the same cover as Java 8 in Action, which underscores that it is a second edition of that volume. In my estimation, the new material does indeed warrant the cost of the upgrade: the sections on reactive programming alone justify the price. For readers not familiar with Urma, Fusco, and Mycroft’s earlier volume, it is one of the best books for getting a firm grip on the cognitive load required by the new features in Java 8 and subsequent releases.

Also in This Issue

Javalin: A Simple, Modern Web Server Framework
Building Microservices with Micronaut
Helidon: A Simple Cloud Native Framework
The Proxy Pattern
Loop Unrolling
Quiz Yourself
Size Still Matters