WatersWorks

Blog archive

Scala Creator Odersky on Java 7: Higher-Level Parallelism

There's a lot that's new in Oracle's recent release of the Java Platform Standard Edition 7 (Java SE 7), but for Martin Odersky and much of the Scala community, this release is all about its updated concurrency infrastructure -- the new Fork/Join Framework in particular, which was actually part of the JSR-166 concurrent utilities that didn't make it into Java 5 or 6. "This will no doubt further improve the performance of Scala's higher-level parallelism construct," he said in a released statement, "including its parallel collections and actors."

I recently talked with Odersky while he was in Lausanne, Switzerland, where much of the development for his company, Typesafe, takes place. The months-old commercial startup behind the open source Scala project, which Odersky created, and the open source Akka event-driven middleware framework, maintains its official headquarters in Cambridge, Mass.

The multicore support in Java SE 7 will create even more synergy between Java and Scala, he told me. "We're happy about the release in the sense that the Java platform got a much needed update, further improvements in speed, and some core and key libraries for us as well," Odersky said. "most notably the Fork/Join Framework. We have always had actors, which are built on Fork/Join, and which provide a good way to program concurrent software and distributed programs. Since [Scala] 2.9 we also have parallel collections, which are essentially the same collections as the standard collections, which are pretty nice to use. They get lots of accolades from users. And now everything can be done in parallels. Essentially better Fork/Join means faster parallel collections."

Scala, of course, is a general purpose, multi-paradigm language designed to integrate features of OO and functional programming. Odersky's brainchild runs on the JVM and is compatible with existing Java programs.

The Scala community added the Collections API in version 2.8 last year. The framework provided for the first time a "common, uniform and all-encompassing" framework for collection types. "Actors" are Scala's primary concurrency construct (concurrent processes that communicate by exchanging messages).

The Fork/Join Framework is an implementation of the ExecutorService interface that takes advantage of multiple processors. It was created by Doug Lea, the guy behind most of what happens in concurrency in Java, and it's designed for work that can be broken into smaller pieces, recursively. "The goal is to use all the available processing power to make your application wicked fast," reads the Oracle Java Tutorial.

Lea serves on the advisory board of Odersky's company, as does James Gosling (you know: the Father of Java). Odersky describes Typesafe as "the commercial arm of the Scala and the Akka projects."

"We develop the language a little bit, but that's more a community job," he said. "But we have an open source Eclipse IDE that has been progressing nicely, and a type-safe stack that consists of the Scala runtime, the SBT that's the Scala build tool, and the Akka middleware. And we support that stack typically for very large enterprises."

Odersky says the number of Scala users is growing at a slow, but accelerating rate.

"We think we have more than 100,000 [users] now," he said. "Two years ago, Scala started from nothing has gone up steeply since then. Overall my best guess is that we have about 1% of the Java market now, but that's doubling a bit faster than once a year. Once percent doesn't look like much, but when it's doubling every year, it looks pretty promising."

I asked Odersky what he would put on his Java SE 8 Wish List. He said he had two that he was sure wouldn't be fulfilled in the next release: 1) for Oracle to finally update the class-file format. "Even in the pure Java world, you'd have a good motivation to do something about that. But it's even more pressing in Scala, because Scala produces a lot of Closures." 2) a proposal called Public Defender Methods or Virtual Extension Methods, which addresses the problem that, once an interface is published, methods can't be added without breaking it. The proposal would allow for the addition of new methods to existing interfaces, and it would allow the Collections interface to take advantage of Closures.

"But I have to say that what's going to be in Java 8 is perfectly fine," he added. "It will pose no problems for us, and I'm sure we will profit directly from these improvements."

Odersky also said that he, like many in the Java and related communities, is happy to see the end of the deadlock on the Java Community Process.

"Not having a new release out for five years is certainly not something that you want," he said. "It's good that things move forward again. And I do believe that the JVM as a platform has a great future."

Posted by John K. Waters on August 16, 2011