FAQ: Project Lambda brings drastic change to Java
In 2014, Java will get its biggest upgrade since Java 5, ten years ago. Some believe that Java 8 will revolutionize the way developers program while others approach the changes with a bit more trepidation. For those developers who are hesitant to take the leap, here are some frequently asked questions that will help you prepare for the changes to come.
What changes can I expect from Java 8?
Java 8 is best known for Project Lambda, an initiative that leverages the concept of closures. Until now, Java was the only established programming language that did not take advantage of closures, and in its new format it will significantly cut down on the language's wordiness.
Java 8 will also take on interface evolution, enabling interfaces to contain defensive methods instead of just abstract methods and constants. In an article called Lambda, Java 8, interface evolution and laws of unintended consequences, Brian Geotz, Java language architect at Oracle, describes the process of decorating interface methods with the default keyword, an approach that will allow developers to add a method to an interface in a way that's compatible, so long as a default implementation is provided.
What does project Lambda entail?
In short, Lambda is the initiative that adds closures to Java. The ultimate goal of this undertaking is to help developers more adequately abstract over behavior, making the language more functional. Lambda requires less code and will replace many complex, iterative, MapReduce-like algorithms. Java champion, Adam Bien, describes Lambda as simple language adjustment that will fit neatly into various frameworks like Swing, JavaFX and any event programming.
Why will we be seeing such drastic changes in this version of Java?
The changes to Java are motivated by a desire to simplify Java's syntax and to make data processing more efficient. For example, closures will allow chunks of code to be read as pieces of data. According to Geotz, a method can be treated as a variable and can ultimately be passed into a method as though it were, in fact, an instance. This, he says, will drastically alter the way that Java libraries are developed.
Should we be worried about all these modifications?
Some Java developers are indeed worried that Lambda's intention to simplify the language is too ambitious for a single upgrade. The default methods upgrade, for example, radically alters a basic language feature, giving some developers the impression that Java 8 is forcing in features that Java -- and Java developers -- might not be ready for.
That said, Bien discusses why these changes are not as drastic or frightening as many have been led to believe. His assertion is that developers who can code in different languages recognize that Java 8 is a mere incremental shift when compared to other languages. It just seems like a giant leap for those who only work in Java.
Do you think Project Lambda forces too much change into one upgrade? Let us know.
23 Jan 2014