16 Comments

Summary:

The Scala programming language is one big reason why applications like Twitter, LinkedIn and Foursquare have taken off among mobile phone users. Meet Martin Odersky, the man behind the language.

Typesafe co-founder Martin Odersky

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 Javac, the most widely used Java 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 make 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 be 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.

 

  1. Can you substantiate this “most widely used Java C compiler” with a reference? I’m sure you won’t find one.

    Share
    1. Hi. this came from ton of programmers i’ve talked to over the past year — many of whom are not wild about scala but love Java. But i’m open to suggestions — which you say is the most widely used?

      http://www.infoq.com/articles/ScalaNETInterview

      Share
    2. I think they meant the Java Generic compiler

      http://en.wikipedia.org/wiki/Generic_Java_(programming_language)

      Share
    3. It’s javac, the Sun (now Oracle) Java compiler.

      Share
    4. Pls read again. It says “javac” the most widely used Java compiler (ships with every Sun/Oracle JDK) and not “Java C compiler” as you put it.

      Share
  2. Renato Cavalcanti Tuesday, November 27, 2012

    The Scala logo shown here is wrong. It was picked from http://www.scala.com which has nothing to do with the Scala programming language. Please, go to http://www.scala-lang.org for the right logo and website.

    Share
    1. thank you. will fix.

      Share
  3. Hmmm…. I see a lot of talk about Scala but an actual lot of use of Groovy. Doesn’t solve the same problem but they seem to be pitted against each other sometimes.

    Share
    1. @philh do you use Groovy and or Scala? would love to hear about relative advantages etc.

      Share
      1. Victor Tarnavski Tuesday, November 27, 2012

        Groovy is slow. Really. It much more easier, though. Scala entry barrier is really big and scaring a bit.
        But Groovy and Scala have different purpose. Groovy isn’t a language of choice for any large project. Rather it is just a scripting language. And scala is great for system of any complexity.

        Share
      2. Groovy is a great language and is not slow, actually it is pretty fast for a dynamic language. Also it has optional static compilation, if you need the speed. Groovy is used in large projects like Sky.com, with its Grails frameworks for rapid development. It also has a smooth learning curve, due most Java code being Groovy valid code. You can slowly learn the cool stuff in it without fighting against it. In a company i worked we made some studies and ended using Groovy with no regrets :-)

        Share
  4. @Barb you obviously had no clue about the subject matter while writing this article did you?

    Share
  5. Starting in 2013, the very thing that Martin states is needed (simplified approach to multi-threaded applications) will become a reality. How simple is it to create 100% parallel code using our new approach? How about no coding, no scripting, just natural human language phrases? Our apps generate their own self tuning/scaling/synchronizing CPU Assembly, GPU Assembly/shader/compute kernels, C++ and other languages on the fly and for all the main chipsets. It’s that simple. We go into Alpha with the first “Super App” next month (BTW, thats also when our team starts designing the user experience without coding or scripting). We’re already seeing stunning results (e.g. A single server running our code is faster than thousands of servers running C++). We’re really excited about 2013.

    Share
  6. Could Ozzie’s spreadsheet analogy have been about parallel computing (not about doing so functionally)? That would make sense.

    Share
    1. Yes. Parallel computing is a game changer if you can avoid the diminishing return scenarios (such as big cost for coding talent and increased difficulty in finding bugs). Taken to the maximum potential (100% parallel code), while avoiding diminishing return scenarios produces a massive gain in processing speed (according to Amdahl’s law, a theoretical infinite speed up potential). Next year is going to be awesome!

      Share
  7. And now you can learn Scala through Coursera’s course offered by EPFL’s own Martin Odersky: https://www.coursera.org/course/progfun

    Share

Comments have been disabled for this post