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.
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.
Sign up for CIO Asia eNewsletters.