Wednesday, May 2, 2012

Xamarin releases XobotOS


A company has substantially ported Google's Java-based Android software to use C# and the .NET framework, a move that could be the first step towards creating an Android-like operating system that avoids legal entanglements with Oracle.

Android's primary application environment is based on the Java technology first developed by Sun, now owned by Oracle. Google's decision to use Java in Android has resulted in a decidedly inconvenient—and potentially expensive—copyright and patent lawsuit with Oracle. Java wasn't, however, the company's only option: it briefly considered, and then ignored, Microsoft's .NET runtime and C# programming language. Like Java, .NET and C# offer a convenient, modern, object-oriented language and API. Unlike Java, much of C# and .NET are covered by ISO standards, with legally binding commitments from Microsoft to not sue implementers of the specifications for patent infringement.

While Microsoft's own .NET implementation is the best-known and most widely-used, there is a high-quality third-party implementation called Mono. Since May last year, development and maintenance of Mono has been handled by Xamarin, a startup created by core Mono developers after a long and complicated history with Novell and Attachmate. Xamarin has two important products: Mono for Android and MonoTouch, bringing Mono development to Android and iOS, respectively.

Xamarin developers started a skunkworks project to port the Java parts of Android to use C# and .NET instead. The result is XobotOS.

To create XobotOS from a million or more lines of Java, Xamarin used the Java-to-C# conversion tool Sharpen. The company had to develop and improve Sharpen so that it could handle the complexity of the Android codebase, and a small proportion of the code had to be manually ported (especially parts that interface with the underlying operating system).

XobotOS is not just interesting because of its Java avoidance. Mono performs well, and can run .NET programs much faster than equivalent Java programs in Android. The Mono virtual machine is quite mature when compared to Google's Dalvik virtual machine, and is capable of more extensive optimization than Dalvik. There are also some performance-enhancing features that Microsoft added to .NET that Java lacks (such as generics that are built into the runtime, and low-overhead "value types" for small objects).

Xamarin says that XobotOS is only a "research project" and that it doesn't intend to maintain it as a standalone project. Instead, it is using the work done to create XobotOS—such as the improved version of Sharpen, and an improved graphics library that uses the operating system directly rather than going via Java—to improve its Mono for Android product.

The .NET-based XobotOS stands a good chance of avoiding the patent claims that Oracle is making against Google. The 6,061,520 patent, in particular, is quite specifically Java-based. It describes a way for addressing some difficulties presented by the Java specification. The other patent in suit, RE38,104, has the potential to also apply to Mono, but the validity of this patent is questionable as it has been preliminarily rejected under re-examination by the US Patent and Trademark Office.

This still leaves the copyright issue, as the Android source code implements many of Java's APIs; the automatic translation performed by Sharpen would not avoid such difficulties. Purging the source of the 37 APIs that Oracle is suing over would require a substantial effort, but .NET may be helpful even there, as it provides alternatives to many of those APIs, and makes a few of them superfluous.

While Xamarin does not intend to develop XobotOS further, it is, like Android, open source, published under the Apache license. With this foundational work done, a lawsuit-averse developer—or even Google itself—could make the first moves towards building a Java-free Android operating system.

No comments: