Mono developers port Android to C#
Xamarin, the company that specialises in developing Mono – the open source implementation of Microsoft's C# and .NET plaform – has been porting the Java-based Android API to C#. The Xamarin developers had been considering how they could improve the performance and battery usage of Android applications.
They came to the conclusion that Google's Dalvik Android virtual machine (VM) is still young and not as performant and tuned as Mono, and that it suffers from many of Java's performance limitations while not being able to benefit from the optimisations from Oracle’s HotSpot VM. According to benchmarks, a C# application running on the Mono VM performs much better than a Java application running on Dalvik virtual machine. Mono also has the advantage, says Miguel de Icaza, founder of Xamarin, that C# and the .NET virtual machine were standardised at ECMA and ISO and are covered by various patent and community promises.
These factors, in turn, led them to consider reimplementing Android in C# and running it on the Mono virtual machine, in what they called the "XobotOS" project. To create the C# version the Xamarin team used the Sharpen tool to port the more than 1 million lines of code of Android 4.0 (Ice Cream Sandwich) from Java to C#. The result of this work has been that the Mono coders now have "most of Android's layout and controls entirely in C#" and running on Linux workstations. The work involved enhancing the Sharpen tool, which converts Java to C#, further. The enhanced Sharpen is included with the rest of the release of the "XobotOS" software project, which is now available on GitHub.
There are no plans to develop the XobotOS research project for production use. Xamarin said that its goal as a company is to provide the best platform for building mobile apps, but that some of the research work will be included in future versions of its Mono-based products for Android. For example, the project showed them ways to enhance the graphics performance of C# code by directly accessing the lower level graphics of Android and how to replace more performance critical Java code with faster C# code.
Developers behind Xamarin include many of the Mono developers who were laid off by Attachmate as the company completed its takeover of Novell. The company's portfolio offers software packages for developing Android and iOS apps using the Mono platform.