Foreword - Mastering Lambdas: Java Programming in a Multicore World (2015)

Mastering Lambdas: Java Programming in a Multicore World (2015)

Foreword

Java SE 8 may well represent the largest change ever to the Java language and libraries. Since you’re reading a book called Mastering Lambdas, you probably already know that the biggest new feature is the addition of lambda expressions. Depending on your perspective, this evolution began in 2009 (when Project Lambda was launched), or 2006 (when several proposals were made for adding closures to Java), or 1997 (when inner classes were added), or 1941 (when Alonzo Church published his foundational work on the theory of computing, from which lambda expressions get their name).

However long it took to get here, it’s about time! While it may initially appear that lambda expressions are “just another language feature,” in reality, they will change the way you think about programming, offering a powerful new tool for applying abstraction to the programming challenges you face every day. Of course, Java already gives us powerful tools for abstraction, such as inheritance and generics, but these are largely about abstracting over data. Lambda expressions complement these by giving us a better tool for abstracting over behavior.

In embracing lambda expressions, Java has taken a mild turn towards functional programming. While it might seem that object-oriented programming and functional programming are competing disciplines, they offer us complementary tools for managing program complexity. And, as hardware parallelism continues to increase, the building blocks of functional programming—immutable values and pure functions—become even more effective tools for managing that complexity.

Mastering Lambdas: Java Programming in a Multicore World covers all the details of the new language and library features of Java SE 8—lambda expressions, default methods, and the Streams library—in a layered, disciplined fashion. Even more importantly, it connects the details of the features back to their underlying design decisions, enabling readers to get the most out of these new features by understanding the motivation and principles behind them. At the same time, it remains focused on the real payoff, which is not the features themselves, but what they enable: more expressive, more powerful, less error-prone user code. And navigating the reader to this payoff is what this book is really about.

Let Mastering Lambdas be your introduction to programming with this new-and-improved Java. Once you get started, I’m sure you’ll be hooked!