Thursday the 7th of July saw one of the largest milestones in Java’s recent history, the much anticipated launch of Java 7. My initial reaction was it didn’t seem that long since Java 6 was launched, however it was almost 5 years ago, the technical equivalent of when dinosaurs still roamed the Earth.
I think it would be naive to assume that nothing has happened during the reign of Java 6, in fact it’s quite the opposite. The first step towards a better Java was the open sourcing of the JDK, giving developers the opportunity to fix and work directly on the platform. Although I don’t have a direct quote, at the LJC Open Conference in November 2010 it was stated that between the first version of Java 6 and the latest there was a performance gain of over 50%. In Java 6.14 we saw the introduction of the G1 Garbage Collector, another revolutionary change to the options that developers have in terms of tuning and performance. Politically Java has changed hands and governance, passing from Sun to Oracle, and people have their opinions on what this means for Java.
Up until Thursday I was very skeptical about where Oracle might go with Java and how that would change the language I have built my career on. Which brings me to the launch day itself, this began with a webcast held across the world by Oracle. If you missed the webcast you can view it here. We got to hear from some of the senior developers on the Java project, and also from community speakers from all corners of the globe. For the London Java Community, it was an absolute honor and pleasure to see a small group of users that has now risen to almost 1800 members, represented by Ben Evans. I really enjoyed the webcast and thank Adrian Woodhead at lastfm for their hospitality in hosting the webcast for other members of the LJC. That gesture of sharing is something that was also not far from the content of Oracle’s talk, as many people appreciate one of the biggest successes of Java is us – The Community. The value of this has certainly not been underestimated by Oracle and this was evident from the content of the webcast. So what do I think the main themes were to take away from the talk and the event?
- Java 7 is an evolutionary release not an revolutionary release – Mark Reinhold stated that one of the best things about Java 7 is the fact it is shipping.
- Increase in stability
- Increase in performance
- Increase in maintainability
- …Although not said explicitly, the feel of the community is Java 8 is definitely not as far away as the gap was from 6 to 7.
For the event there was then kind hospitality at the Oracle offices, with people from across the community together with a definite buzz and excitement in the room about Java once more.
What is new in Java 7? This could be an entire post/book in itself and each individual improvement could be gone into in great detail. I’ll attempt to pick out a few key points below and give links for more information. I’d also recommend reading Mark Reinhold’s blog. The best summary of the below I have read so far is in Java 7 developer MEAP, by Ben Evans and Martijn Verburg.
- JSR 292 Invoke Dynamic
- This is one of the major steps that we are seeing towards a change in the way that we view Java. What even is Java? I think we are seeing a separation of Java the language and the Java Virtual Machine. Strictly speaking, it’s not really the Java VM now, but just the VM. Highlighted by the gentleman in the video wearing a Python jacket over a Java T-Shirt, the VM is now home to many dynamic languages. Invoke Dynamic is another step towards the multi-language support for the JVM. Simply put it supports the invocation of allows a non-Java call to be made and for the linkage to be determined at runtime… OK that wasn’t so simple, but you can read more about the project here.
- JSR 334 Project Coin
- Project coin are all about small changes to the Java language to make life easier for daily use of the Java programming language. A few of my personal favorites are:
- Ability to switch on String! Finally, it’s only taken 15 years.
- Diamond Operator, no longer do you need to declare the generic expression on the right hand side if they are present on the left:
- Old Way: List<String> myFingersAlreadyHurt = new ArrayList<String>();
- New Way: List<String> jsr334SavedMyFingers = new ArrayList<>();
- try-with-resources – lets get rid of some boiler plate code
- You can find the full list here.
- Better Unicode Support
- Not too excited about this because it’s not a problem I run into. However, from speaking to a few people about this at the event – this was going to save them a lot of hassle.
- JSR 203: NIO.2 and File System
- Finally, we have a decent API for interacting with Files and a scalable approach to asynchronous I/O.
- I’m not an expert on the rest of this JSR yet, so might be worth having a read here if you want to know more.
- JSR 166y Fork Join Framework
- Doug Lea and his concurrency experts have created the Fork Join Framework. This allows for concurrent tasks that involve splitting a larger programmatic problem into smaller blocks of computation i.e. Merge Sort a nice framework in which to operate. The ForkJoinPool uses workers to perform the tasks placed upon it, which are also capable of stealing tasks from other workers if they are no longer busy.
I think the next few months in the Java community will be exciting ones, with July being very much the month of Cloud and is Java the right language for the cloud? For those in London that haven’t been along to a Java event yet, please come along and join us on meetup.com and join us at our developer pub session to get involved in the discussion.