Thursday, April 14, 2016

Google Has A Language Problem

Apple had a language problem, which it solved in 2014 with Swift. It is now Google's turn to be in a situation not unlike Apple's, before the introduction of Swift: Google has a language problem.

The problem is Java, which is used to develop apps on Android, and internally at Google to create many of their own apps. The issue with Java is that it is controlled by Oracle, a company Google is fighting in court, and as a 20-year language that evolves very slowly, it is now just plain obsolete. To solve this problem, Google needs a new language, and I see 3 possible contenders, Kotlin, Swift, and Scala:

Kotlin Swift Scala
Benefits compared to Java High High Very high
Controversial Low Medium High
Difficulty to target Android Low Hard Medium
Difficulty to target iOS Hard Low Medium
Difficulty to target the Web Medium High Low

Other alternatives exist, but seem less realistic, at least in the short term:
  • A new Google language - Apple created its own language: Swift. So, couldn't Google come up with their own language as well? This would be a major undertaking. It isn't something outside of Google's league, but if such a large project was underway and getting even remotely close to something they could release, Google being a fairly open company, we would by now have heard about it.
  • An existing Google language - That would be: Go or Dart:
    • Go is designed for system programming, not application programming. It doesn't compete with languages like Kotlin, Swift, or Scala, because it wasn't designed to.
    • It would be all too easy to criticize Dart as a programming language, or describe how much of a failure Dart has been as far as its adoption goes, both within and outside Google. But there is no need to go there given the question that interests us. It suffices to say that Dart, maybe even more so than Go, hasn't been designed to compete with languages like Kotlin, Swift, or Scala, but rather in an attempt to be attractive to JavaScript developers reluctant to use strongly typed languages (ultimately a market it lost to TypeScript).
Getting back to our 3 contenders, no clear winner emerges from the above table:
  • Swift has a lot going for it, but a large amount of work would be needed to make it a viable first-class programming language for Android (think: IDE, APIs, interop with existing code). And maybe even more importantly, how wise would it be for Google to bet on a language designed and controlled by one its competitors?
  • Scala is the best technical solution, both for the capabilities of the language itself, its IDE support (JetBrains' own IntelliJ, Eclipse, and through ENSIME in Emacs, Vim, and Atom), a rich library ecosystem, its ability to target the web through the production-ready Scala.js, and a project underway to create a LLVM backend, which would enable it to target iOS. But the complexity of the language, both real and perceived, is a big hurdle to overcome.
  • Kotlin can be seen as a lesser-Scala: from a technical perspective, it might not be as strong as Scala, but it is strong-enough, and it is less controversial than Scala, and thus easier to sell to Java developers.
If I were Google's language tzar, that is, in the unique position to decide on Google's language strategy, I could see myself go with Scala. If instead, I had to bet on what option Google would go for, assuming it goes for one, I would put my money on them adopting Kotlin.

JetBrains is, to their credit, a fiercely independent company, so I'd be surprised if Google were to acquire JetBrains, but I can see Google announce they will support Kotlin as a first-class language for Android development, along Java. And maybe even will work with JetBrains to improve their JavaScript backend, and together work a on an  LLVM backend, ultimately allowing the same code to be compiled for Android, iOS, and the web.