A Discussion with Josh Bloch on the Future of Java
Josh Bloch - a prominent contributor (you might know some of his work if you've ever used the Java Collections framework) to the Java platform at Sun for many years, currently a Googler, author of the award winning books "Effective Java" and "Effective Java Second Edition" - gave a talk at the recent web-based Red Hat Middleware 2020 conference. The thrust of the talk was guarded optimism and concern about the future of the Java platform under Oracle's stewardship. InfoQ contacted Josh to see if he would be interested in expanding upon these ideas. The discussion - particularly apropos of the increasing exodus of Sun talent from Oracle and concerns over Oracle's handling of the community and the Java Intellectual Property looming - is reaching a fever-pitch of late because it intersects many different, going concerns. We were glad to be able to talk to Mr. Bloch about some of these.
InfoQ : What is your main concern?
I don't have a single main concern. Several factors that have combined in the past few years to take the wind out of Java's sails.
InfoQ: Why do you feel the march of evolution for Java has slowed?
- The Sun / Apache stalemate TCK licensing stalemate has all but eliminated progress via the JCP.
- Sun's lack of support, leadership, and clarity has kept Java 7 from making perceptible progress. I'm not sure people are aware how few resources Sun allocated to Java SE in the past few years. But the consequences have been quite visible: every year JavaOne rolls around, and Java 7 seems no closer. And there has been an awful lot of infighting among Java's supporters. In earlier days, Sun played the role of benevolent dictator, which helped to limit the infighting.
- The use of GPLv2 for OpenJDK hinders adoption even by those who are less concerned with TCK issues. The "copyleft" provisions scare away many potential corporate adopters. As a result, resources are being split between Harmony and OpenJDK. Also the multiplicity of license used by the various JCP members for various components of various standards is just plain confusing. In effect, it places a tax on Java platform development
InfoQ: How can racle better the situation where Sun couldn't?
Oracle has historically supported JCP reforms that would end the stalemate. Also they are in better financial shape than Sun was, so they can afford to reinvigorate the platform and they've publicly declared their intention to do so. Finally, with a changing of the guard, some historical baggage can be jettisoned. Where Sun might have seen certain changes as unpalatable, Oracle might look at the situation with fresh eyes and say "why not?"
InfoQ: Is this all strictly related to the morass of licensing issues?
No; licensing issues play a major role, but it goes beyond that. As I said before, there has been a lack of resources, leadership, and focus.
InfoQ: Is the situation surrounding the Apache Harmony project, which is in turn also used as the basis for the Android libraries, an acceptable one? (Ed: Harmony struggled with Sun over the TCK license well before Google adopted Harmony as the basis for the Android libraries. Google's decision to use Harmony rather than the OpenJDK libraries has less to do with the Harmony TCK licensing dispute than with Sun's decision to use GPLv2 for OpenJDK. Google's partners wouldn't agree to redistribute it without a more permissive license. The Apache group was at one point offered a qualified TCK license, but rejected it because the field-of-use restrictions were unacceptable to Apache and the JCP EC who believed them to violate the JCP agreement.)
No. As I said before, it stands in the way of the health and progress of the platform. Also it is causing companies to waste tremendous amounts of engineering effort, splitting their resources needlessly between Harmony and OpenJDK.
InfoQ: How would you like to see Oracle react to things like Harmony?
I would like to see them enact the resolution they proposed at the JCP EC Meeting of December 12, 2007:
Resolution 1 (proposed by Oracle, seconded by BEA)
"It is the sense of the Executive Committee that the JCP become an open independent vendor-neutral Standards Organization where all members participate on a level playing field with the following characteristics:
- members fund development and management expenses
- a legal entity with by-laws, governing body, membership, etc.
- a new, simplified, IPR Policy that permits the broadest number of implementations
- stringent compatibility requirements
- dedicated to promoting the Java programming model
Furthermore, the EC shall put a plan in place to make such transition as soon as practical with minimal disruption to the Java Community."
As for the "new, simplified IPR Policy," I believe it would be highly beneficial to the entire community if a widely accepted permissive open source license such as Apache or BSD were adopted for all components of all Java specs.
InfoQ: What do you see as Oracle's role?
I would dearly love to see them reclaim Sun's role as leader and steward of the Java platform. Of course things will be a bit different now, because the world has changed. Other organizations will contribute more resources and share more control.
InfoQ: For that matter, how do you think things like Dalvik fit in the brave new Oracle Java landscape?
In the brave new world of open source, multiple related platforms are a given. There are many Unix-like operating systems and many Linux variants, optimized for many uses. I see Dalvik as a VM designed with a very different set of design goals and constraints from HotSpot or JRockit.
InfoQ: Following up on that: how do you see Java ME evolving? Being outright replaced? Could Sun "bless" Android as the next-gen Java ME? How can Java ME compete in an Android/iPhone world?
I don't think it's appropriate for me to speculate on this one, though it is worth pointing out that there's certainly a place for "feature phones" (as opposed to "smart phones") in the developing world, and Java ME was designed with feature phones in mind.
InfoQ: At least one, recent index (Tiobe's list) has shown a decline in the use of Java.
It showed a slight decrease in Java use and a corresponding increase in C use. I'm not sure if this is real or a statistical anomaly, but it is amusing to see a 35-year old "universal assembly language" at the top of Tiobe's list. I confess to having a soft spot in my heart for C.
InfoQ: This is probably provable (one way or another), but do you suspect that the JVM's use has decreased over all, or that Java proper has decreased while Ruby/Scala /Jython /Groovy have taken up the slack?
Actually none of these languages make Tiobe's top 20. That doesn't mean they aren't important or valuable; they are. But they aren't mainstream, yet. That said, I'm absolutely thrilled by the amount of language research and design going on these days. There are plenty of good ideas out there, and it's marvelous that people are exploring them.
InfoQ: Do you think Java's on the decline, or that we should be concerned?
I think it's fair to say that Java's had a hard couple of years. But I do not think the platform or the language are in decline. I think there is some danger of a decline, but I'm counting on Oracle and the Java community to prevent it. Yes, I do believe it's cause for concern. I believe a strong Java is good for the programming public: corporations, higher education, K-12, the open source community, you name it.
InfoQ: What, in your opinion, could hope to replace it (that's not also on the JVM)?
With the exception of CLR which is in-practice a Windows-only platform, there's no real alternative to the JVM on the horizon. In fact, there's no real alternative to the Java programming language either. There are plenty of other great programming languages, but none with the same "design center." A language is a tool, and we should use the right tool for the job. One size does not fit all.
InfoQ: Is there a business case to be made for licensing the JRE?
Perhaps some esoteric variants. But I believe it's in Oracle's interests, just as it was in Sun's, to keep the JRE ubiquitous.
InfoQ: Following up on the last one, a bit, but also as a standalone point: how do you feel about the proposed reconciliation of the JRockit JVM and the Sun JVM and various other VM technologies?
In principle I believe it's a good thing to take the best parts of the various JVMs and combine them into something even better. But remember that Sun never even succeeded in combining the client and server variants of HotSpot. Combining multiple systems is where angels fear to tread. It's sometimes doable, but never easy. Failed efforts can be very costly.
InfoQ: Anything else you might add? What do you feel needs to be said?
I just want to remind people that many recent Java success stories are getting lost in all the gloom and doom. Among them are Google Collections, Guice, the JVM languages you referred to earlier, and Android. With swift, decisive action on Oracle's part, and cooperation from the broader Java community, I see a bright future ahead for the Java platform.
Java/JRockit needs a proof of life on desktop
For Java/JRockit... no one cares. We need proof of life.
The time is now!
Is this what you really want Josh?
Well Josh, do you not take any responsibility for that? Seriously, we all remember your parleys talk “The closure controversy” and how it divided the community and basically put java in an endless loop of discussions for the last two years. If you are talking about Java as a language then I specifically recall you saying that Java has “used up its complexity budget” and it would be a “huge mistake to add any language feature” to java and your “vote would be to freeze the java language”. I am pretty sure you’ll agree that it’s hard to evolve Java the language when you don’t actually want to make any changes to it.
Re: Is this what you really want Josh?
I specifically recall you saying that Java has “used up its complexity budget” and it would be a “huge mistake to add any language feature”.
Josh is advocating for leadership, licensing changes, and resources. He is not changing his stance and now advocating for complex features.
Many in the community back Josh's position (closure issue specifically).
The JVM will thrive, but the writing is on the wall for the language itself
What would make for a suitable successor to Java? Many languages have appeared on the scene which offer much greater expressiveness, but most of them do so at the twin costs of 1) performance and 2) static typing. While there are some applications where language performance doesn't matter a lot, and for small applications the loss of static typing may not be a problem, but a real successor to Java can't exact such penalties.
As another InfoQ article has pointed out, Scala is the exception to the rule. It offers near-Ruby-like expressiveness with Java-like performance and type-safety. And it addresses concurrent programming (through its emphasis on immutable data structures, functional programming, and the actor model), a concern which the programming community is feeling with increasing pressure. There seems to be a sentiment that Scala is difficult to learn, but in fact much of the perceived complexity is in advanced features, e.g. that a DSL designer would use -- ordinary programming actually seems considerably easier than in Java. If you have programmed in Ruby, you'll know what I mean by that.
As the designers of Ruby and Groovy have pointed out, Scala is the obvious contender for the slot that Java's sluggishness has only served to open up faster. It's hard to believe that so many of us still program without closures.
Java the language will still be used for a long, long time, just as COBOL is. But most really good programmers have already been looking at alternatives; I personally think that in a year or so most of the best programmers will be off of Java and will prefer to do their work in another language, likely Scala. InfoQ actually thinks the shift will be even faster and more dramatic.
Re: The JVM will thrive, but the writing is on the wall for the language it
I still want closures (and mixins and type inference and ...), but I don't fully understand the costs of adding closures to Java. Perhaps if I did know, I would agree with Josh (who is a very bright fellow and has contributed immensely to the success of Java). But given the interoperability of Scala with Java, the many other features that Scala already offers in addition to closures, and the fact that it is improving at a far faster pace than Java has been, there is little downside to learning some Scala and throwing a Scala class or two into the mix. :^)
Re: Is this what you really want Josh?