Goetz hangs his hat on lambda parallelism and performance

When it comes to improving Java, few changes have been as eagerly anticipated as lambdas. From parallelism to performance, the lambda experiment is working, and smart software developers are adopting it.

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.

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.

Java has finally caught up! 

Java Language Architect Brian Goetz

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?

Parallelism

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.

Performance

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.

Readability

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.

This was last published in September 2014

PRO+

Content

Find more PRO+ content and other member only offers, here.

Essential Guide

JavaOne 2014: Takeaways from Java's biggest conference

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudApplications

SearchSoftwareQuality

SearchFinancialApplications

SearchSAP

SearchManufacturingERP

DevOpsAgenda

Close