Cometh The Hour, Cometh The Xobot

Poor old Android is having a bad year. (Especially compared to last year.) Apple’s iPhone is soaring in China, and apparently overtaking Android in the crucial American market. Oracle’s lawsuit against Google has led to several rather awkward claims, eg that the word ‘license’ in the phrase “we need to negotiate a license for Java under the terms we need” referred to “not a license from anybody”, a kind of license with which I was previously entirely unfamiliar. CEO Larry Page’s own testimony was labelled as evasive: “His denial of knowledge and recollection contrasts with evidence,” wrote Florian Mueller of FOSS Patents.

What a headache. Way back in 2005, Android head honcho Andy Rubin wrote in a prescient email:

“If Sun doesn’t want to work with us, we have two options: 1) Abandon our work and adopt MSFT CLR VM and C# language – or – 2) Do Java anyway and defend our decision, perhaps making enemies along the way.”

Just imagine if they’d taken the first road. It’s not widely understood in the industry that Microsoft’s .NET infrastructure is more open than Java in many ways; it and its flagship language C# are ISO and ECMA standards, available to anyone and everyone, legally bulletproofed by the Microsoft Community Promise. Imagine if the Android OS ran on an entirely different technical architecture.

Wait, no. Don’t imagine it: examine it. Like a vision from a parallel universe, it now exists.

Way back in 2001, Miguel de Icaza realized that if he ported .NET to Linux, he would open Linux up to a huge new developer community — and vice versa. The Mono Project was born. it wound up in Novell’s hands, where it continued to mature. Last year much of the Mono team founded a company called Xamarin, whose MonoTouch software lets developers write native Android/iOS apps using .NET technologies.

Android apps run on Google’s Dalvik virtual machine. “Dalvik’s fairly immature, and Mono vastly outperforms it,” says Xamarin’s CEO Nat Friedman. “So we started thinking: hey, what if we translated the entire Android OS to C#? It would run faster, and it wouldn’t have any legal problems.”

First it was just a thought experiment. Then it became more of a science project. And then the Xamarin team actually did it, by adopting and improving a tool named Sharpen that translates Java to C#, and using it to translate the entire Android 4.0 (Ice Cream Sandwich) codebase. They did get a few side benefits — that improved tool, and better graphics handling — but mostly they did it for fun, aka the love of making something better. Oh, and they’ve now open-sourced the whole thing, under the name of XobotOS.

What does this mean? Good question. Maybe it’s an impressive technical achievement that’s ultimately inconsequential except as a bright feather in Xamarin’s cap. (If the idea was to get developers’ attention, they’ve certainly succeeded.) Maybe it’s Plan B for Google, in case there is some (unlikely) legal catastrophe.

And maybe the next company that thinks about forking Android for their own use — as Amazon did with the Kindle Fire, and as RIM had to have at least considered last year — will decide to go the Xobot route, for better performance, for legal cover, as a major differentiator, and to appeal to the huge and thriving .NET developer community. On the other hand, existing apps would either have to run on the IKVM virtual machine atop Mono (after tweaking it to handle Dalvik .dex files) which would mean a performance hit, or be Sharpened to C# and recompiled.

Still, at the very least, it’s a technically impressive and interesting feat. And who knows? Watch this space. It just might turn out to be a genuinely disruptive one as well.