Xamarin's port of Android to Microsoft's C#: Five questions (and answers)

Xamarin's port of Android to Microsoft's C#: Five questions (and answers)

Summary: Xamarin chief Miguel de Icaza answers five questions about XobotOS, the skunkworks project to port Android to C#.


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!

Topics: Android, Smartphones, Security, Open Source, Mobility, Mobile OS, Microsoft, Hardware, Google, Software Development


Mary Jo has covered the tech industry for 30 years for a variety of publications and Web sites, and is a frequent guest on radio, TV and podcasts, speaking about all things Microsoft-related. She is the author of Microsoft 2.0: How Microsoft plans to stay relevant in the post-Gates era (John Wiley & Sons, 2008).

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.


Log in or register to join the discussion
  • the community rejects M$ tainted technologies

    Nobody would ever use mono/C# since they are tools from an evil monopoly.
    De Icaza is spreading FUD about Dalvik's performance and pushes a proprietary component in the Android stack that is open.
    On the other hand, award winning journalists have found that Mono has been abandoned by OSS developers :: http://techrights.org/2012/01/18/xamarin-and-mono-kaput/
    The Linux Geek
    • Dr. Roy Schestowitz

      Yea, I don't really agree with anything he says.
    • Looks like someone just hit a nerve...

      Your lack of discernment with this article is troubling.

      This project won't go anywhere and is purely an academic exercise. Get over it.
      And by the way, you can remove your Linux eyeshades. Tons of people use C#.
    • Obviously you are not a software developer

      If you'd actually used Java, you'd understand why this project started or why Android phones with bleeding edge hardware still aren't as fast or smooth as WP7 on single core.
    • Choose between Microsoft and Oracle ...

      to quote what de Icaza said
      "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."

      Microsoft's past behavior over some things earned the "evil monoply" tag. It's hard to find any of that since the DOJ case which was 12 years ago, but assuming ANY company won't take a future opportunity to do that in future would be naiive. Microsoft has unbreakable legal commitments which prevent it doing those things in specific cases: if you lack the mental flexiblity to accept that Microsoft isn't the same company it was 10 or 15 years ago, then ignore those commitments, stick your fingers in your ears and shout "La la la la la I'm the community and we're not listening."
      If you can't accept there may be other "evil monopolists" out ther - that Microsoft is the only one and Apple, or Google, or Oracle display no behaviour whatsoever which deserve the "evil monopoly" tag, again fingers in the ears and "La la la" ...

      Oracle now owns java and it's behavior re: Android matches the "Evil monopoly" label.

      So: choose the lesser of two evils. Microsoft, given what it has done or Oracle, given what it has done.
  • La de da time?

    I know why Oracle was miffed at Google, but have decided, in lieu of a verdict or Judge's ruling, that there is no basis in law for Oracle to claim damages.

    What de Icaza's team have produced here seems to be a bit more than proof of concept, but not really a turnkey component, so speculation is premature.

    Too early to speculate, and yet...

    Would Microsoft not be concerned about something which seems to make it easier for Windows developers to port to Android?

    Maybe I'm misunderstanding the use case.
    • No MS standardized C# and opened sourced .net for exactly these purposes.

      MS has given mono tons of help. btw these same huge perf gains are very typical for asp.net web apps over java app platform apps as well. Big sites can get 2-3x the number of requests/box at the same req/sec, letting them run the sites on half the hw. If google had been smart enough to take this for android they wouldnt be in their current mess with oracle right now and android apps could have about 20x perf increase and android phones could have much longer battery life. Its not a coincidence that WP runs smoother on old single core cpus than android does on quad cores.
      Johnny Vegas
      • .NET vs Java

        I prefer programming in C# vs Java all day long. If there is a peformance advantage, it's with the runtimes not the languages themselves. That being said, I haven't seen anything that compels me to believe that the .NET or Mono runtime is any more efficient than Java or visa versa.
      • Give it a break

        2-3x performance for asp.net compared to what? I've seen nothing to support this position and we're a large user of Java EE v6.

        Java VM / Java EE AS performance is very good for a very complex platform.

        Your 20x performance increase for mono over java is also a fallacy. The article states the optimised Java VM performance is better than mono.

        True Google wouldn't have been sued by Oracle, but to claim MS wouldn't have had a go against them is ridiculous.

        Mono was always a project looking for users. With the breakup of Novell, it's major sponsor and user, it's now looking for relevance. It make absolutely no sense on Unix. C# only exists because of the antitrust trouble MS got into with Java.
        Richard Flude
  • Of course, since it's all open sourced...

    There's nothing from someone *else* taking all of this and turning it into a viable product...

    Hmmm.... :)
  • XobotOS probably not going anywhere

    Nice idea, but no smartphone vendor is putting it on their phones.
  • Haha

    Microsoft should pick this up and ditch WP7! =D
    • Hardly, WP7 is basically an even faster version of this,

      most likely, as I haven't used XobotOS. WP7 runs faster on older slower hardware than Android does on faster hardware. Microsoft has learned what it needs to do to compete and is doing that more and more across the board. I prefer bing to google, xbox to other consoles, Windows Phone to either Android or iPhone, and like how Windows 8 is looking. I still use other things when needed, but I like how Microsoft is finally taking on the challenge and trying new ideas. I'd like to see more new ideas from Android and iOS on interfaces and integration and in general more open-ness in formats and software.
  • Let's use C++ & Qt...

    if we are concerned about the speed. ;-)

    Like Nokia did with N9. :-)
    Solid Water