Scala designer cites goals, directions for JVM alternative

Developer Martin Odersky discusses origin and plans for Scala, a statically typed language that can be used to build Android apps

Martin Odersky is the designer of the Scala programming language, a general-purpose statically typed language that runs on the Java Virtual Machine. It can be used to build distributed systems and even Android mobile applications. Odersky is chairman and chief architect at Typesafe, a company offering a Scala-based software stack geared to parallel and distributed computing environments. He also teaches in Switzerland. Scala debuted in 2003 and was redesigned two years later. Recently, Odersky fielded questions about Scala from InfoWorld Editor at Large Paul Krill.

[ In a recent InfoWorld interview, Ruby language creator Yukihiro Matsumoto set his sights on the mobile space. | For more on software development, see InfoWorld's Developer World newsletter. | Follow Paul Krill on Twitter. ]

InfoWorld: What was your intent in developing Scala?

Odersky: Originally it was curiosity, whether we could combine functional and object-oriented programming in a package that was useful to people [and that] would make it a powerful language. It was very much driven by, yes, essentially research. Once we found this worked, we switched gears and really devoted all our activity to supporting it. We first supported an open source system around it. We have started to offer commercial support and do the commercial [entity] since last year.

InfoWorld: Why did you want to combine object-oriented and functional programming?

Odersky: It felt like it would be the right thing to do, to have very complementary strengths. So functional programming is in a sense very clean, it can be very powerful. It makes it very easy to construct things out of simple elements. Object-oriented programming has a very good story when it comes to essentially the evolution of large systems. It can subclass, you can specialize existing systems. I always felt it would be very interesting to combine the two, and I think the success of Scala has shown that yes indeed, there is something there.

InfoWorld: The term "functional programming" -- it seems so vague.

Odersky: Programs are composed of essentially variables and operations of those variables and functions that operate on those variables. Functional programming means put the functions first. That means emphasize programming purely with functions that map input to input values into results and de-emphasize mutating variables. At first glance, it's a very mathematical model of programming, you might say, because that's really the mathematical approach. It actually turns out now that it's also a very good approach if you want to deal with concurrency and parallelism.

InfoWorld: Why did you redesign the language in 2005? What was the problem with the original design?

Odersky: There was no major problem. It was just that essentially we did the first iteration, and after two years, we noted that there were some minor syntax things where we said -- well, actually we found ways to express [that] more elegantly, and over the years, we added new things, like more generalized pattern matching. But the main point in 2005 was that we rewrote the compiler. The first complier for Scala was written in Java, and the second compiler that came out in 2005 was bootstrapped, written in Scala itself. We decided to do some little design changes. At the time, Scala didn't really have many outside users yet, so it was very easy to do.

InfoWorld: Why did you want to use the Java Virtual Machine for Scala?

Odersky: Two reasons. The first one is my personal experience. I've been on the JVM from the time it was still in alpha. I actually wrote, I think, the second Java compiler in 1995. That compiler then with twists and turns, eventually became Java C, so the standard Java compiler. I also found that the JVM would be an excellent target because of essentially two things. The first is it was a high-performance runtime, and the second thing is it had a garbage collector. Scala is object-oriented and functional; a high-performance garbage collector is absolutely essential to make this run well.

InfoWorld: What types of applications are ideal for development with Scala?

Odersky: It's really a very, very broad set of applications, The uptake is particularly strong in Web companies, so it runs on quite a few of the most high-traffic websites on the Internet and in the financial sector.

InfoWorld: Recently you've cited a need for better development tools for Scala. Has any progress been made in that regard?

Odersky: Yes, we have made steady progress. We have now the Eclipse IDE in beta, and we're nearing the final version [of] Eclipse 2.0. The uptake has been pretty good and the response has been very good, as well, that people are finally no longer worried about lack of IDE performance.

InfoWorld: What's happening with your company, Typesafe, and why did you recently step down as CEO?

Odersky: That was essentially a schedule change because I have a dual role. I'm at Typesafe and at EPFL (École Polytechnique Fédérale de Lausanne). I have to go back to teaching next week actually, and because of that and also because I wanted to focus more on the technical part, the architecture and less on the management parts, I was very happy to have Donald (Fischer) take over as CEO. As you can imagine, the company has grown quite a lot since its launch, so with a growing company the demands on the management side, of course, they also grow.

InfoWorld: What is the company doing these days? What's the business plan?

Odersky: The business plan is to continue to build and expand the Typesafe stack, which consists of the Scala runtime, Akka middleware, and we're going to announce some other components of this Typesafe stack very, very soon to provide support for that and to add some products around that. As a second part of the business, we have a very active training business, so we give a lot of courses on both Scala and Akka, and we see a lot of demand for that right now.

InfoWorld: Scala is emerging as a language for building Android applications. There seems to be a group of developers, particularly in the Boston area, using it for that. Does this surprise you at all?

Odersky: No, because like I said, it essentially can replace Java wherever it is. I've actually experienced that, I've known that. Scala just gives you more productivity, so whether you program for servers or for clients, more productivity is always welcome.

InfoWorld: How does Scala differ from other JVM languages, such as Groovy and JRuby?

Odersky: Groovy and JRuby are both dynamic languages or, more precisely, dynamically typed languages. Scala is a statically typed language, so it's in that sense in the same camp as Java, which is another statically typed language. That said, the types in Scala are, at the same time, more expressive and less cumbersome, so they're less cumbersome to write than in Java. Sometimes, Scala feels like a dynamic language, but it isn't really, because it really does have the static type system. And the static type system has advantages when it comes to performance. Scala programs run very fast, about as fast as Java programs. And it has advantages for tooling so that you can have essentially code completion in IDEs, you can have better refracturing and all these things.

InfoWorld: What's the next step for Scala? Any new versions coming out soon?

Odersky: We just released [version] 2.9.1, which was a bug fix release and a release that gave better performance. The interactive shell is starting up very, very fast now, much faster than before. The next major release, 2.10, will have a number of additions in particular on the side of reflection, so there will be Scala-specific reflection, and there will be a range of new libraries.

InfoWorld: What does "reflection" mean?

Odersky: Reflection means that you can, from a running program, introspect. You can find out what code you are running, what classes you have, what members these classes have. Essentially the whole structure of a program that is in the head of the programmer or that's known to the compiler is then opened at runtime. Reflection does exist for Java since Java 1.1. That gives you essentially the Java view of a Scala program when it runs, but we wanted to lift it up, the whole level, to Scala, so that Scala programs could see themselves as Scala programs, not just Java programs.

InfoWorld: Are you familiar with the Kotlin language from JetBrains? I believe they looked at Scala and wanted to go their own way. Do you have any perspective on Kotlin at all?

Odersky: Yes, I've looked at it. I think it has elements of both Scala and C# in a new language. It's not out yet, so to comment further I think we should all wait when it's out and we have something concrete to try.

This article, "Scala designer cites goals, directions for JVM alternative," was originally published at InfoWorld.com. Follow the latest developments in business technology news and get a digest of the key stories each day in the InfoWorld Daily newsletter. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

Read more about application development in InfoWorld's Application Development Channel.

This story, "Scala designer cites goals, directions for JVM alternative" was originally published by InfoWorld.

Insider: How the basic tech behind the Internet works
Join the discussion
Be the first to comment on this article. Our Commenting Policies