By Tori Wieldt on Nov 26, 2013
After delivering the Devoxx keynote, Java Chief Language Architect Brian Goetz talks to OTN. He takes on the question of why lambda expressions took so long to implement and how lambdas will impact developers.
Ed Burns, Consulting Member of Technical Staff, and Kinman Chung,
Principle Member of Technical Staff, both at Oracle, presented a session
on Monday in which they described new features in JSR 341, Expression
Language (EL) 3.0. They discussed the APIs for the use of EL in
standalone environments and EL syntax for new operators, plus lambda
expressions, and support for collection objects, all the while offering
copious code illustrations.
Burns remarked that he was pleased that Java Champion and JavaOne Rock Star Adam Bien had referred to EL 3.0 as “the hidden gem of Java EE”. “I don’t know how hidden it is,” said Burns, “but I think it’s a gem.”
He discussed the origins of EL, which has a long and active history in the Java platform. EL began in 2004 as part of the Java Standard Tag Library (JSTL 1.0), moved to JSP 2.0 in 2006, and became an independent specification with JSR 341 in 2011. It is used in JSF, CDI, and Avatar. Now, 9 years after its inception, it is an independent specification that is heavily used in JSF.
Burns observed that the presence of EL is the key differentiator between Java server and non-java server stacks. “Java server-based web frameworks are likely to use EL,” said Burns. “When you show someone who is not familiar with EL how easy it is to move things together from disparate parts of your application, it’s very compelling.”
The most important feature that EL 3 brings is lambda expressions – developers do not have to wait until Java SE 8 is released. It all runs on Java EE 7, which requires Java SE 7 -- which means that it is currently available. Burns gave a brief discussion of lambda expressions, which basically behave like an anonymous function -- lambdas in EL are EL expressions. They offer full access to the EL environment within the body of the EL lambda expression, something not available from Java SE lambdas. “You won’t be able to refer to other EL things from a plain old SE lambda expression,” said Burns.
The goal of EL 3 is to provide greater expressive power for applications and to use it outside of Java EE. Burns and Chung provided an overview of collection operations and explained EL’s support for stand-alone environments. EL 3 is easy to use outside of Java EE and provides standard data structures: ELContext; ELResolvers; and local variable and function repositories.
They explained that it enables direct EL operations and has: EL expression evaluation; Bean definition; and Function definition. They emphasized that other key parts of Java EE can also be used standalone, such as: Bean Validation; Persistence (JPA); and Contexts and Dependency Injection (CDI). They encouraged developers to consider the possibilities for cloud deployment in: Defining functions and variables and defining beans.
They spent the rest of the session illustrating their key points with a healthy dose of code.
Links and Downloads:
* JSR 341: http://www.jcp.org/en/jsr/detail?id=341
Download spec and API javadocs
* Project home: https://java.net/projects/el-spec/
Report spec bugs or RFE for el.next
* RI: https://java.net/projects/uel/
Maven artifacts available from Maven Central
Download source and report RI bugs
* Integrated in Glassfish 4.0: https://glassfish.java.net/
You can listen to this session in early October on Parleys.com.
JavaOne Rock Stars, conceived in 2005, are the top-rated speakers at each JavaOne Conference. They are awarded by their peers, who, through conference surveys, recognize them for their outstanding sessions and speaking ability. Over the years many of the world’s leading Java developers have been so recognized.
Martijn Verburg has, in recent years, established himself as an
important mover and shaker in the Java community. His “Diabolical
Developer” session at the JavaOne 2011 Conference got people’s attention
by identifying some of the worst practices Java developers are prone to
engage in. Among other things, he is co-leader and organizer of the
thriving London Java User Group (JUG) which has more than 2,500 members,
co-represents the London JUG on the Executive Committee of the Java
Community Process, and leads the global effort for the Java User Group
“Adopt a JSR” and “Adopt OpenJDK” programs.
Career highlights include overhauling technology stacks and SDLC practices at Mizuho International, mentoring Oracle on technical community management, and running off shore development teams for AIG. He is currently CTO at jClarity, a start-up focusing on automating optimization for Java/JVM related technologies, and Product Advisor at ZeroTurnaround. He co-authored, with Ben Evans, "The Well-Grounded Java Developer" published by Manning and, as a leading authority on technical team optimization, he is in high demand at major software conferences.
Verburg is participating in five sessions, a busy man indeed. Here they are:
All of which raises the question: If these practices are so bad,
why do developers engage in them? “I've seen a wide gamut of reasons,”
said Verburg, who lists them as:
* They were never taught at high school/university that their bad habits were harmful.
* They weren't mentored in their first professional roles.
* They've lost passion for their craft.
* They're being deliberately malicious!
* They think software development is a technical activity and not a social one.
* They think that they'll be able to tidy it up later.
A couple of key confusions and misconceptions beset Java developers, according to Verburg.
“With Java and the JVM in particular I've seen a couple of trends,”
he remarked. “One is that developers think that the JVM is a magic box
that will clean up their memory, make their code run fast, as well as
make them cups of coffee. The JVM does help in a lot of cases, but bad
code can and will still lead to terrible results! The other trend is to
try and force Java (the language) to do something it's not very good at,
such as rapid web development. So you get a proliferation of overly
complex frameworks, libraries and techniques trying to get around the
fact that Java is a monolithic, statically typed, compiled, OO
environment. It's not a Golden Hammer!”
I asked him about the keys to running a good Java User Group. “You need to have a ‘Why,’” he observed. “Many user groups know what they do (typically, events) and how they do it (the logistics), but what really drives users to join your group and to stay is to give them a purpose. For example, within the LJC we constantly talk about the ‘Why,’ which in our case is several whys:
* Re-ignite the passion that developers have for their craft
* Raise the bar of Java developers in London
* We want developers to have a voice in deciding the future of Java
* We want to inspire the next generation of tech leaders
* To bring the disparate tech groups in London together
* So we could learn from each other
* We believe that the Java ecosystem forms a cornerstone of our society today -- we want to protect that for the future
Looking ahead to Java 8 Verburg expressed excitement about Lambdas.
“I cannot wait for Lambdas,” he enthused. “Brian Goetz and his group are doing a great job, especially given some of the backwards compatibility that they have to maintain. It's going to remove a lot of boiler plate and yet maintain readability, plus enable massive scaling.”
Check out Martijn Verburg at JavaOne if you get a chance, and, stay tuned for a longer interview yours truly did with Martijn to be publish on otn/java some time after JavaOne.
Originally published on blogs.oracle.com/javaone.
Some day I will make it to Devoxx – for now, I’m content to
vicariously follow the blogs of attendees and pick up on what’s
happening. I’ve been doing more blog "fishing," looking
for the best commentary on 2011 Devoxx. There’s plenty of food for
thought – and the ideas are not half-baked.
The bloggers are out in full, offering useful summaries and commentary on Devoxx goings-on.
Constantin Partac, a Java developer and a member of Transylvania JUG, a community from Cluj-Napoca/Romania, offers an excellent summary of the Devoxx keynotes.
Here’s a sample:
“Oracle Opening Keynote and JDK 7, 8, and 9 Presentation
• Oracle is committed to Java and wants to provide support for it on any device.
• JSE 7 for Mac will be released next week.
• Oracle would like Java developers to be involved in JCP, to adopt a JSR and to attend local JUG meetings.
• JEE 7 will be released next year.
• JEE 7 is focused on cloud integration, some of the features are already implemented in glassfish 4 development branch.
• JSE 8 will be release in summer of 2013 due to “enterprise community request” as they can not keep the pace with an 18 month release cycle.
• The main features included in JSE8 are lambda support, project Jigsaw, new Date/Time API, project Coin++ and adding support for sensors.
JSE 9 probably will focus on
some of these features:
1. self tuning JVM
2. improved native language integration
3. processing enhancement for big data
4. reification (adding runtime class type info for generic types)
5. unification of primitive and corresponding object classes
6. meta-object protocol in order to use type and methods define in other JVM languages
8. JVM resource management”
Ivanov, of SAP Labs Bulgaria, also commented on the keynotes with a different
focus. He summarizes Henrik Stahl’s look ahead to Java SE 8 and
JavaFX 3.0; Cameron Purdy on Java EE and the cloud; celebrated Java
Champion Josh Bloch on what’s good and bad about Java; Mark Reinhold’s
quick look ahead to Java SE 9; and Brian Goetz on lambdas and default
methods in Java SE 8.
Here’s St. Ivanov’s account of Josh Bloch’s comments on the pluses of Java:
“He started with the virtues of the platform. To name a few:
Tightly specified language primitives and evaluation order – int is always 32 bits and operations are executed always from left to right, without compilers messing around
Dynamic linking – when you change a class, you need to recompile and rebuild just the jar that has it and not the whole application
Syntax similarity with C/C++ – most existing developers at that time felt like at home
Object orientations – it was cool at that time as well as functional programming is today
It was statically typed language – helps in faster runtime, better IDE support, etc.
No operator overloading – well, I’m not sure why it is good. Scala has it for example and that’s why it is far better for defining DSLs. But I will not argue with Josh.”
It’s worth checking out St. Ivanov’s summary of Bloch’s views on what’s not so great about Java as well.
What's Coming in JAX-RS 2.0
Marek Potociar, Principal Software Engineer at Oracle and currently specification lead of Java EE RESTful web services API (JAX-RS), blogged on his talk about what's coming in JAX-RS 2.0, scheduled for final release in mid-2012.
Here’s a taste:
“Perhaps the most wanted addition to the JAX-RS is the Client API, that would complete the JAX-RS story, that is currently server-side only. In JAX-RS 2.0 we are adding a completely interface-based and fluent client API that blends nicely in with the existing fluent response builder pattern on the server-side. When we started with the client API, the first proposal contained around 30 classes. Thanks to the feedback from our Expert Group we managed to reduce the number of API classes to 14 (2 of them being exceptions)! The resulting is compact while at the same time we still managed to create an API that reflects the method invocation context flow (e.g. once you decide on the target URI and start setting headers on the request, your IDE will not try to offer you a URI setter in the code completion). This is a subtle but very important usability aspect of an API…”
Obviously, Devoxx is a great Java conference, one that is hitting this year at a time when much is brewing in the platform and beginning to be anticipated.