How Martin Odersky rewrote the rules of coding for a mobile world

Next time you pull out your smartphone to use a popular application  – whether it’s to price check items in a store, to tweet or to check your cloud-based calendar — you might thank Martin Odersky.

Odersky is something of a superstar in the Java programming world. He wrote the most widely used Java C compiler, and now he’s the force behind the fast-growing Scala programming language. That language makes it easier for developers to code for “parallelism,”  which is what allows tens of thousands of people to use an application at the same time without crashing it.

In the pre-cloud, client-server era, you might have had a couple hundred  – or maybe thousand –  users hammering on a server-based application. But they accessed it from company-issued PCs, so programmers could assume a finite number of users and make sure they had enough server power and bandwidth to support that number.

That all goes away in today’s world, where millions of people use popular applications at the same time. How many smartphone users hit Twitter during a major sporting event? Or on election day? Your guess is as good as mine. It is that scale that parallelism enables and that Scala helps makes easier to program.

Why Scala?

Up until a few years ago, to make applications perform better you installed a faster processor. But we’ve pretty much maxed out the speed limit for individual chips. So best way to get better performance now is to use chips with multiple cores, all operating at a high speed, and to spread the workload among them. Here’s an admittedly simplistic analogy: Instead of packing multiple tons of cargo onto a single huge freighter, you divvy the load up among an array of smaller boats that can move faster.

The key is to have a captain who knows how to take advantage of that expanded fleet — or, to bring the analogy back to the tech world, an application that knows how to take advantage of those multiple cores. Instead of writing a program that runs on a single core, you have to write a program that’s smarter about deploying the workloads among many cores.

“Single-core performance is running out of steam, and you need to parallelize everything,” Odersky told me in a recent interview. You do that through what’s known as functional programming. Ray Ozzie, the former chief software architect for Microsoft and no slouch when it comes to coding, likens functional programming to spreadsheets where each cell in the spreadsheet containing that formula acts as an independent processor working concurrently to keep the spreadsheet updated. It’s a parallel computing system enabled by functional programming, Ozzie says via email.

Scala works with Java and compiles in the JVM, which is significant because many, many of the world’s enterprise applications are written in Java. It’s not a stretch to say there are millions of Java programmers (Oracle, which now owns Java, claims 9 million.)  With Scala these programmers can keep using their Java libraries, frameworks and the JVM while also taking advantage of functional programming, which tends to be less verbose than Java code.

That brevity leads to more compact, elegant software compared to older-style imperative programming. With imperative programming, variables can evolve over time, while in functional programming variables keep the same value. The notion of shifting variables poses a problem in a parallel process where one part of the program executes based on an older value that has since changed.

Scala gains steam

In September, Redmonk analyst Stephen O’Grady used data from Github and Stackoverflow to show Scala on its way to becoming a top-tier language, along with Java, Javascript, PHP, and Python. Other functional languages such as Erlang and Haskel have their admirers but their user base isn’t growing as fast, according to this data.

Odersky, a professor at the Ecole Polytechnique Federale de Lausanne (EPFL) in Switzerland, is also co-founder and CTO of Typesafe, a San Francisco startup that promotes the use of Scala and related Akka middleware, especially in the enterprise. Typesafe customers include LinkedIn and the Dutch Border Patrol, which uses a Scala-based application to photograph every car coming into the country and quickly know — based on the license plate — whether to stop that car or not. Twitter and FourSquare are also Scala users. Odersky also teaches a Coursera class on Scala that drew an astounding 45,000 registrants.

“I studied with lots of amazing people at MIT, but very few successfully cross that academic-to-business divide, and Martin has,” says Bill Kaiser, a partner with Greylock Partners, a Typesafe investor. Odersky’s ongoing interaction with students allows him to stay involved in what’s new in programming, adds Mark Brewer, CEO of Typesafe, who jokes that Odersky spends about 50 hours a week on Typesafe business and another 50 teaching.

The programming pantheon

Those two and others make the case that Odersky belongs in the same pantheon of programming gods as James Gosling, the father of Java itself; Niklaus Wirth, who wrote Pascal (and with whom Odersky studied); Anders Hejlsberg, of Turbo Pascal fame; and Bjarne Stoustrup, who wrote C++ and other languages.

Rod Johnson, the co-founder of Springsource, now part of VMware, and now a director of Typesafe, says Martin “absolutely” belongs in this august company. “Considering prior art in each case, I would rate Scala as a more impressive — and original — achievement than Java or C# and on a par with C++,” Johnson says via email. “The way Scala successfully mixes functions and objects; the way in which it resolves the multiple inheritance problem; its effective type inference; and its interoperability with Java are all particularly impressive.”

The next frontier

Odersky said the explosion of mobile devices continues to challenge programmers. While new languages and tools like Scala helped, more needs to be done to deliver software that keeps up with the new hardware. For one thing, it needs to bet much easier for non-programming geniuses to both write and troubleshoot such software.

“If you want to write a multi-threaded application now it’s still nightmarishly difficult. There are lots of mistakes that are hard to detect. We have to make programming these kinds of applications feasible for everyone, not just experts and that is very hard,” he says.

For more on Odersky and Scala, check out this video of a talk he gave at Intel.

Intel hosts Dr. Martin Odersky presenting Scala 2.10 from Typesafe on Vimeo.

 

Powered by WPeMatico

Leave a Reply