alt
October 1st, 2012

by Ivan St. Ivanov

So, finally! I am at my first JavaOne! What an exciting event it is! Maybe because of this, or maybe because of the jetlag, I was up at 4 am this morning, at quarter to 8 I registered and half an hour later I entered my first session. Before proceeding to that, just to mention that today was day 0 of the conference. Which is especially for NetBeans, Glassfish and for the communities and user groups. So it’s kind of out of the official schedule, but still it has some great content. Of course, the most interesting part was in the evening when we saw the first two keynotes. But, first things first

Business meets engineers meet scientists

The first talk that I visited was by two London Java Community folks: James Gough and Richard Warburton. In fact, LJC is one of the most active and vibrant user groups in the world and its activities never stop to amaze me.

The whole idea of the talk was to show us that the problem domains of the business (that requests the software), the engineers (who implement the software) and the scientists (who come with bright new ideas on how software can be implemented) are quite different. And usually those who don’t understand the matter from each side use their own terminology to cover their incompetence. These were called ‘bluffers’.

Each slide presented a new term from all three domains. For me it was particularly interesting to understand what linear regression, Markov chain, continuous uniform distribution, poison distribution and Kronecker delta meant. So interesting, that I immediately forgot their definition. But of course, everybody can look them up in internet…

Finally I got the idea behind tail call recursion, why it is needed and what’s the difference between that and normal recursion. Basically, if the compiler finds that the return statement just calls the same method (without applying any calculation on its return value), then it translates this method call to simple loop. Which is much faster to execute than calling a new method (which involves creating a stack, pushing parameter values there, etc.).

At the end the speakers challenged us to count the bluffers at this conference. Hmm, did they mean JavaOne or maybe Oracle Open World (which is held exactly at the same time in the Moscone and Moscone West convention center)?

JavaFX and NetBeans platform

To be honest, I am not a JavaFX developer. I did my last desktop application [Swing] UI somewhere in 2002. And I never did any RCP programming, neither with Eclipse, nor with NetBeans. However, I visited this session as I wanted to keep in touch with what’s happening and also because I could not find anything more interesting in the same time slot.

This was kind of a panel session, where we saw four short presentations and demos of different achievement in combining JavaFX with legacy (Swing based) technologies.
Most of the demos were on how you can make a Rich Client Platform application using NetBeans as its core platform to look sexier with applying JavaFX controls, animations and effect instead of pure Swing. The NetBeans IDE itself seems the best prepared of  for developing in JavaFX (no surprise here). It supports such things as CSS code completion, FXML editor and even Scene builder, where you can drag and drop controls, change their properties, etc. and finally it generates all the underlying XML for you.

One very interesting usecase for JavaFX is if you want to reuse as much as possible when building an application that runs on desktop and in a browser (including mobile). In the first case you have a Swing app and for the second you want to use HTML5. JavaFX can combine both worlds with its WebView control, where you can embed your HTML5 canvas, and JfxPanel control, which is the silver bullet for anything written in Swing.

At the end we learned something very important when you want to combine JavaFX and Swing into one application: they are using two different threads. So if they both share data, you have to take care for synchronizing the access to that data.

Help with developing OpenJDK

The next panel talk was on inspiration. Four guys from the London Java Community (Ben Evans and Martijn Verburg among them) talked on the adopt openjdk initiative, which is part of the larger adopt a jsr program. Basically, this effort is driven by the community and not by Oracle. The Java stewards are just helping with organizing it, but the main job is done by the people all around the world.

The basic idea is to get people like you and me fixing really small stuff: javadoc errors, using generified instead of raw types in the JDK class library internals, apply project Coin changes in the codebase, etc. This way the more experienced Oracle developers would be able to concentrate on really important features like lambdas, jigsaw, date and time API, etc.

As a first step, you may get the source and build it. It’s quite easier now, as the build means running one script and takes about 10 minutes. Reading the code is the next step – even the C/C++ sources (which are mainly in the HotSpot VM) are very easy to understand. Unfortunately importing it into the IDE is still a tricky task. It’s easier to do it in NetBeans (even though it doesn’t work out of the box there either).

The contribution culture in OpenJDK is not like in the github social coding. If you want to develop something bigger than a small bug fix, you need to sign a special license agreement with Oracle. Even then the process of taking your change into the official release is not as easy as you might expect.

And now for the most interesting and inspiring part of the talk – the bugathons. It’s a special process where your Java User Group can follow and contribute to the Open JDK. The idea behind bugathons is that you may gather with your user group, find a reviewer and ask them what is the most important thing that you may contribute. Then the reviewer will find a reasonably simple feature or bug fix. Then your JUG gets some pizza, some beer and has fun developing that feature. Finally it submits the diff in Mercurial (this is the version control that is used by Open JDK). All the details are explained in detail on this wiki.

Last week there was a discussion in the Bulgarian JUG mailing list on what activities we can have. I plan to propose this as soon as I find time to write. Who knows, maybe the next Brian Goetz lives in Sofia? 😉

The keynotes

We moved out of Moscone West to the Masonic Center for the last couple of sessions of the day. They were held in a big amphitheatrical hall which was supposed to gather all the attendees (and it really did). As an introduction, we had a brand new Java song with James Gosling participating in its video.

Then several Oracle executives and vice presidents came to the stage to share their managerial slides with us and to tell us how much has Oracle achieved in the last year and what are the outlooks for the future. The motto of this year’s conference was announced to be “Make the Future Java”. I expected big news here, but the only thing that caught my attention was that project Nashorn was open sourced and contributed to the Open JDK. For Java EE 7 I heard nearly the same things that I did two years ago at Devoxx. The only difference was that standardizing the cloud is now moved to Java EE 8. There were also a few companies that came out on the scene for their five minutes of fame. The most prominent was AMD, who announced their joint project with Oracle – project Sumatra. Its goal is to enable Java application to take advantage not only of the multiple cores on the CPU, but also of the GPU. And this should be done totally transparently for the developers.

Then we saw Robert Ballard (the person who found Titanic) on the scene to talk about inspiration. He talked also about exploring the unknown, and in this sense, the most notable quote from him was that his greatest discovery is the one that he is about to make. At the end of this first keynote we saw JavaOne’s diamond sponsor IBM on the stage.

After a short break followed the more interesting, technical keynote. It was given by Oracle’s Java architects and developers, so there was no much fluff, just stuff. The introduction and the announcements were made by Mark Reinhold, the Chief Architect of the Java Platform Group. He first invited Richard Bair and Jasper Pots, who showed a JavaFX application and tried to convince us what a fun was to develop it. They announced that JavaFX is already available on Mac and Linux. The NetBeans scene builder was demonstrated and at the end some event handling code was shown. Hmmm, it was not greatest coding fun that I have seen so far – too many if’s, for loops and anonymous inner classes.

But it was done on purpose, so that Brian Goetz could come on the scene and explain how project Lambda would solve these issues in Java 8. The lambda functions would replace the anonymous inner classes and thus make the code more readable. The new methods on the collection APIs (foreach, filter, sum, etc.) would replace the nasty if’s and for’s and thus move away from the client code the control of the iteration. The default method implementations would make it possible for interfaces to be extended with new operations without the fear that existing contracts would be broken. For all those of you curious to try the new project, there are builds available for download.

As I read somewhere, this year Oracle embedded Embedded java in the conference. We saw how you can run a JavaFX application on a kiosk running with not very powerful processor and limited amount of memory. The JDK was stripped intentionally for this purpose, but the real hit here would be if project Jigsaw would have made it for Java 8. We all know that it was postponed to Java 9. But Mark showed us the project state – the JavaFX application was broken into several modules, which themselves had their requirements to several levels of external modules. We could see how by only knowing your “main” module you could download the ones that it requires. And then to run the application without providing single jar on the classpath (there’s no even such a thing as classpath). All the magic was hidden in the jmod tool, which knew what it needs to download and then how to bundle it for the application start.

At the end we saw what is there in Java EE 7. Besides the regular topic of JAX-RS 2.0, where we have standard client API and which is now part of the web profile, we saw a lot of planned support for HTML 5:

  • Standardized server side implementation for WebSocket support
  • Standard Java API for working with JSON (similar to JAXP for XML)
  • Support for the new HTML 5 forms

We have also some long awaited enhancements like JMS 2.0 and Java Temporary Caching API finally being included in the umbrella spec.

The last demo of the day was about a new NetBeans project called EASEL. Its goal is to facilitate the HTML5 development. If you have experience with plugins like Firebug, which you can use to debug your JavaScript code from the browser, then maybe you’ll get an idea what this project does. It actually gives something more: while debugging, you could change your HTML/JavaScript code and could see your changes simultaneously in the browser. If I didn’t get it wrong, it works only with WebKit-based browsers.

So, that was all for day 0. I will finish with the quote of the day by Mark Reinhold. While discussing the modules that he needed to run his Jigsaw enabled application, he stated that “No Java Program is complete without commons.logging.”