We use cookies to provide you with a better experience. If you continue to use this site, we'll assume you're happy with this. Alternatively, click here to find out how to manage these cookies

hide cookie message
78,762 News Articles

Scala: The Android programming language you didn't know you had

Statically typed Java language pushed as alternative to JRuby and Groovy for building mobile Android apps

Scala, a statically typed language running atop the Java Virtual Machine, is emerging as a development option for building Google Android applications.

While developers already are aware of Java and C++ language usage for Android, they also can use other JVM languages because Android leverages the Java-compatible Dalvik VM, reasoned developer Mike Burns, of Thoughtbot, a Web and mobile application development company. "There's a growing community of people [developing] with Scala," he said.

[ Scala has been in need of more tools to boost enterprise usage. | Keep up with the latest developer news with InfoWorld's Developer World newsletter. ]

Members of the Boston Android Developers Group, for instance, have begun to leverage Scala for Android development, said Burns, who runs the group: "Scala lets you write the code more quickly and share the code more easily than you can in Java." Burns will be presenting on the notion of Scala as a replacement for Java on Android at the Android Open conference in San Francisco in October.

Scala founder Martin Odersky vouched for Burns's claims: "I can confirm what he says: Scala is an attractive development language for Android. I should also mention that there's tool support in the form of an Android plug-in for SBT, Scala's standard build tool." Google declined comment on the subject of Scala development for Android. But the Google Project Hosting website features a Scala-Android project for tools to build Android applications via Scala.

For mobile applications, Scala enjoys advantages over other JVM languages, such as JRuby or Groovy, because statically typed languages run faster, consume less memory, and generally are better optimized, said Burns. Android, he stressed, runs on embedded devices with slow processors and little memory.

In a blog post this past spring, Burns touted Scala's programming characteristics: "Scala can be thought of as a better Java. To start with, you don't need as many semicolons. But Scala gives you the power of modern abstractions. Traits, implicits, type-checked null, blocks -- everything you really need to get some solid coding done."

The Dalvik VM, said Forrester analyst Jeffrey Hammond, uses its own byte code format to execute applications. Google uses Java as the intermediate language that gets compiled into the .dex format, he said: "Looks like what Mike is trying to do is set up Scala as a way to write apps and generate .dex byte-code as an alternative."

Burns said he has written some Scala programs for Android, including one based on the Umbrella Today weather predictor. He lists benefits of Scala development for Android as speed, easier programming, and the existence of a vibrant community around it. Downsides, though, include unknowns, with the practice being uncharted and lacking documentation.

Android, of course, is the subject of a lawsuit by Oracle against Google, alleging infringement of Java patents in Android. But Burns is not dissuaded by the litigation. "I don't really follow that closely," he said.

This article, "Scala: The Android programming language you didn't know you had," 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.


IDG UK Sites

LG G Watch review: Android Wear smartwatch is the best around, so far

IDG UK Sites

How to join Apple's OS X Beta Seed Program: Get OS X Yosemite on your Mac before public release

IDG UK Sites

Why the BBC iPlayer outage was caused by a DDoS attack: Topsy and Tim isn't *that* popular

IDG UK Sites

See Glasgow 2014 in UHD as history is made