Every dominant programming language on the market today leverages the powerful idea of closures, except for one. The one that's lagging behind? It's Java, and for years it seemed like nothing would get done about it.
As many as fifteen years ago, when Martin Odersky of Scala and TypeSafe fame, and Phillip Wadler released the experimental "Pizza" project, people have been trying to make closures an essential part of the language. Despite being seen as overly complicated, the Java community seemed to come around to the idea of including closures in the language around 2008. Then those plans were put on hold as Oracle gobbled up Sun Microsystems and Java languished while new releases of the language were repeatedly postponed.
But things are changing in a big way with Java 8, and the programming community better be ready for it. "This is perhaps the biggest upgrade ever to the Java programming language," says Brian Goetz, Oracle’s Java Language Architect, indicating that the inclusion of closures will change the way Java programs are developed in an even more significant way than the way the inclusion of generics in Java 5 changed the way we code. "Just as generics allowed developers to better abstract over types, the goal of Lambda is to help developers better abstract over behavior."
Lambda is the name given to the project that binds closures to the Java programming language. And what will Lambda and the inclusion of closures, do? The idea is that programmers will be allowed to treat a chunk of code as though it were a piece of data. A method can be described and characterized in the same manner in which you would declare and use a variable, and that newly characterized method can be passed into a method as though it were indeed an instance or a type. "This may not seem like a big deal, but in reality it is a huge deal," said Goetz. "This will fundamentally change the way we develop Java libraries."
It has been a long time in the coming, but with the release of Java 8, the Lambda project will finally become a full featured part of the Java specification. A syntax that was originally discarded as too complicated for the typical developer to handle will eventually become a standard artifact to be seen in every modern Java application.
Edited by: JDenman on Oct 1, 2012 4:09 PM