JavaOne 2014: Takeaways from Java's biggest conference
A comprehensive collection of articles, videos and more, hand-picked by our editors
Java Language Architect Brian Goetz is always a great person to have kick off a Java developers conference. Sure, Mark Reinhold, Chief Architect of the Java Platform, always gets to begin these sessions and deliver the 50,000 foot view of how things are shaping up, but it's Goetz who is always the true headliner.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
For the past few years, the big topic that everyone seems to want to hear about from Goetz has been lambdas. But there's always been a certain feel of uncertainty in his tone when speaking about the topic. Being an architect and not a salesman, he's never been afraid to talk openly about some of the challenges that needed to be addressed in order to shoehorn these new features into the language.
Taking a gamble on lambdas
It's not that Goetz wasn't sure in his ways, but in the past, so many questions hung over the head of the lambda project that everyone knew the roll-out of Java 8 was going to be a bit of a gamble. But now that the product has been implemented, the cloud of uncertainty has gone away, and it appears that Goetz can gloat, seeing that the gamble has paid off.
"Java has finally caught up" said Goetz at the JavaOne Technical keynote. Caught up to what you ask? Well, with all of those other languages that don't get lost in verbosity like Java does. But catching up is one thing. Going beyond is something else, and in that arena, Goetz believes that Java does indeed have "a few tricks up its sleeve." So what are some of these up-sell features for lambdas?
Dealing with collections is really at the core of what enterprise applications do. With Java 8, "all of the collections libraries are de-composable making them parallel ready," said Goetz. Of course, part of making collections lambda ready was introducing the default method concept in order to support the introduction of the new stream method to all collections, but so far there have been no complaints of that new construct being misused or abused. The fact is, in a modern, multi-core environment, supporting parallelism is important. When your programs can take advantage of parallelism, they can use hardware resources more efficiently.
While sometimes it may not appear to be the truth when you look at your code, the fact is, there is a great deal of optimization with lambdas. What might look like three or four method calls works out to just one simple instruction on the compiler. "We have caught up in expressiveness, but moved way ahead in terms of performance," said Goetz.
When taking a functional approach to programming, software applications become easier to read, and code tends to read like the actual problem statement. This makes debugging and long term maintainability much easier.
Of course, there were indeed bumps along the way. Making sure lambdas worked without breaking stalwart code that is still running on older JVMs was a challenge. To avoid this from happening, Java had to introduce a new construct called the default method. It became a bit of a shoehorning of the language to fit lambdas in, but the bending of the language hasn't seemed to have caused any issues or problems as of yet.
Java does move forward. It moves forward slowly, but it does move forward. Lambdas was a massive move for a language that doesn't like to budge, but it is clearly being accepted by the community, and it's an accomplishment Brian Goetz can be proud to hang his hat upon.