Parallel dimensions

Brian Goetz opens JAX London with ‘The Road to Lambda’

Taking to the stage for the opening keynote of JAX London, Java Language Architect Brian Goetz spoke of the challenges of evolving a language as established as Java, focusing on Java 8’s headline feature, Lambdas.

He started by giving a mention the London Java Community, who helped run a workshop exploring the new feature in partnership with JAX London over the weekend, and were presented with a Duke’s Choice award recently at JavaOne.

Proclaiming he has “the best job in the world”, Goetz then presented a pie chart illustrating “what people think I do”, including “being a jerk on mailing lists”, “stealing features from other languages”, and mostly “syntax”.



On a following slide titled "what (it feels like) I actually do”, the majority was taken up with “compatibility”, as well as “keeping features out” (to stop it getting “out of hand”, said Goetz) and “regretting serialisation” (“It was an awful idea 17 years ago when it was created, and we’re still regretting it”).

Goetz noted: “The slices for adding things are really quite small, and the slices for identifying things we shouldn’t add are really quite big.”

Yet, that doesn't mean there shouldn’t be any progress. “In the eight years since Java 5, there’s been kind of a lull in the evolution of the platform,” he said, “and we’re trying to make up for lost time.”

When adding new features, said Goetz, there are a number of things to consider: adapting to change and righting past wrongs, while maintaining both compatibility and keeping the language “true to the spirit of Java”.

Goetz then moved on to the meat of the keynote, focusing on the introduction of closures (or, as they are know in Java, Lambdas) to Java 8. With a history dating back to experimental “pizza” work in 1997, he admitted that “it’s been a long journey, and it’s nice to be nearly at the end of that”.

Whilst back in 1995, when Java was first released, closures were considered “too hard” for ordinary developers, today Java is “the last holdout”, said Goetz, and now we are living in a “parallel world” it no longer makes sense to use sequential logic. He noted a key inspiration for this work was Guy Steele’s presentation “How to think about parallel programming - not!”.

Utilising an example where a ‘for’ loop was rewritten to use a Lambda and Collection.forEach, Goetz illustrated how “what” and “how” could be decoupled, allowing responsibility to be moved to the library. “It’s a small, seemingly innocuous change that changes a lot of things,” said Goetz.

Another example was of sorting a list by surname, which today would involve at least five lines and a Comparator. Using Lambdas, it is now possible with just one line of code - and it also looks more like problem statement. “We could have done this with innerClass, but we wouldn’t have bothered,” he said.

Summing, Goetz admitted: “We’re catching up with the competition - it’s the truth.” But he was positive that this new feature will empower library developers while “gently pushing [Java users] towards functional programming, without using the F word”.

He finished by stating that “there’s a lot more work to do”, including dealing with the primitive-reference divide, adding more parallel libraries, and support for value types and tuples, as well as computation GPUs. Still, at least it Lambdas are very nearly here.

Photo by John Stevenson.

Elliot Bentley

What do you think?

JAX Magazine - 2014 - 06 Exclucively for iPad users JAX Magazine on Android

Comments

Latest opinions