Xamarin, the folks that created the Mono open-source implementation of Microsoft's .NET framework, are at it again. This time, they've managed to port parts of Android to Microsoft's C# language.
This skunkworks project, known as XobotOS, was born in interesting times, given the Oracle vs. Google lawsuit over Java and Android. (Remember Google co-founder Larry Page's statement from back in 2005 that if Sun didn't want to work with Google, it had two choices: Adopt Microsoft's Common Language Runtime VM and C#; or "Do Java anyway"?) It's also interesting given Microsoft's latest strategy involving threatening convincing more and more Android OEMs to pay Redmond patent licensing royalties due to alleged infringement of Android on unnamed Microsoft patented code.
Xamarin founder Miguel de Icaza announced the release of XobotOS on github earlier this week. He said that the team managed to port most of Android's layouts and controls entirely in C# using a Xamarin-enhanced version of the Sharpen machine-translation tool.
"Over and over we came back to the basics: (Android's) Dalvik is a young virtual machine, it is not as performant or tuned as Mono and suffers from many of Java’s performance limitations without the benefit of the high-end optimizations from Oracle’s HotSpot," de Icaza blogged. "What if we could swap out Java with faster C# and get rid of various Dalvik limitations in the process? Could we create an Android phone completely free of Java, and free of the limitations of the Dalvik VM?"
While Xamarin isn't going to focus on further and selling Xobotos, de Icaza and team are still interested in seeing where this experiment goes.
I had a chance to ask de Icaza a few questions about XobotOS this week via e-mail. Here's our exchange:
Q: Who do you see as the potential audience/customers for XobotOS? Current Android device makers?
A: The main benefit is going to be customers of both our Mono for Android and Mono for iOS products. In the Android case, because we will be able to replace slow code running in Java, with code that runs on the faster VM, with better optimizations and is not held back by Java's design. In the iOS case, because we will be able to bring some useful code from Android to iOS.
We do not have plans to turn XobotOS itself into a complete competitor to Android. XobotOS is a research project. Usually in the industry the metric is that it takes 10 times effort to turn program or research prototypes into products.
Telcos and OEMs would also have to think about the established user base, and how they could roll something like this out. Judging by the trouble everyone but Apple has rolling out OS updates, I do not believe they are ready to take on a new stack.
Q: Do you think MS might be mad about you doing this? After all, they’re making a lot of money by convincing Android OEMs that they should pay them royalties to head off patent problems in the future. If OEMs adopted XobotOS, could they eliminate this problem?
A: What we know is that Microsoft is asserting some fundamental operating system patents, that are below the level of Dalvik and Java. So they will likely continue doing that, patents on media, operating systems, radios and so on. Ultimately, it seems that people that have settled have decided that they do need those patents.
As for C# and the core .NET VM, Microsoft explicitly granted copyright permissions when they submitted their language and spec to ECMA, and they went beyond the required RAND patent license and granted a very generous and encompassing Community Promise that made C# and .NET a safer bet than Java is today.
That said, I would venture to guess that anyone that loves .NET at Microsoft probably loves XobotOS, as the Apache 2 license means that people can take large portions of Android code and reuse on any of Microsoft's .NET platforms.
Microsoft right now is probably as excited as we are about the possibilities of code reuse both from XobotOS as well as the ability of moving more Java code to C#. Q: Have you heard from Oracle or Google about XobotOS? Do you think either of them might be interested in doing anything with it? And if so, what?
A: We have not heard from anyone, but we only released this research this week.
I would hope that Google would be interested in adopting Mono to run side-by-side Dalvik purely to get a better VM, one that consumes less battery, runs faster and has more features. Keep Dalvik around to run legacy apps, use Mono to run new apps with the benefits of both the more advanced C# language and the VM. But inertia is very powerful. Q: Wouldn't programmers have to write in C# to use this? In other words, wouldn't Google have to uproot its entire dev community if it decided to switch to XobotOS?
A: Not necessarily.
If Google thought that the XobotOS technical merits were something they would be interested in, they would have two ways of dealing with this. The first is to have developers keep developing in Java, and make the Java compiler output .NET binaries (like Microsoft did with .NET 1), or use a tool like IKVM to compile Java code to .NET (which is what people do nowadays to run Java on .NET).
The second approach would be for developers to use Sharpen to rewrite their Java code into C#. This would open the doors to developers to use all of the advanced C# language features that do not exist in Java yet.
Q: What’s your ideal future for XobotOS? Do you want a company to take it and run with it? Someone in the community to adopt it as a project?
A: We are excited about the research results and the immediate benefits that it brings to our own customers on Android and iOS. As to what will happen in the future, it is too early to tell, but we will keep our blog up to date!