Download!Download Point responsive WP Theme for FREE!

Android in C# – XobotOS

Xamarin, the creators of Mono, Mono for Android and MonoTouch for iOS, have ported Android 4.0 or the Ice Cream Sandwich to C#, XobotOS. It is a research project at Xamarin labs, where they ported Android 4.0 from Java/Dalvik to C# to explore the possibilities of improving the performance and memory footprint benefits that C# brings in by leveraging the best parts of .NET/C# such as real generics, P/Invoke, structures etc. They have opened the source of it under Apache 2.0 License. The following picture is adapted from their blogs showing XobotOS powering a Linux Workstation and where no Java is involved.

In order to translate the Java to C# they have used Sharpen (they released source of it as part of GPL) tool. They started with Android 2.0 and as soon as Google released the source of Android 4.0, they took it translated and improved it under C#.

They have said that Android on Mono is much faster than Android on Dalvik, and here is how:

“When C# came around, Microsoft modified the language in a couple of significant ways that made it easier to optimize. Value types were introduced to allow small objects to have low overheads and virtual methods were made opt-in, instead of opt-out which made for simpler VMs. Later on, Java and C# diverged in the way that they implemented generics. Java went with a full-backwards compatibility approach, while C# baked the support into the runtime. The C# approach led to a simple-to-use, simple-to-understand generics setup as well as being much more performant and complete.

Since then, both the language and the execution environment have continued to evolve and improve. C# went from being a slightly better Java to be light-years ahead. From embracing dynamic programming, bring asynchronicity into the language, introduce iterators, functional programming constructs, embrace parallelism and got a great implementation of generics. Many of the these features came from the research done by Don Syme and his F# team that have kept a steady flow of new ideas getting injected into the language.”

The issue here is Dalvik is young and has all the issues that are associated with Java, on the other hand Mono is matured enough, 8 generations, and has all the benefits of C# and .NET. Here is another picture that shows the differences between the Dalvik and Mono (courtesy Xamarin blogs).



Now if Xamarin can work out with Microsoft and port Metro UI on top of this, that would be really awesome. Good luck to Miguel and his Xamarin team.

Sorry Oracle, you won’t get a single dime from this project for your Java patents.

If there is no stuff in this and only a fluff, why would Charlie Kindel get excited to tweet about it!

I have downloaded the XobotOS from github, and I am going to try it on my Sony Tablet S.

Source: Xamarin Blogs and David K