Review: Xamarin 2.0 works mobile development magic

Impressive Xamarin SDK brings native iPhone and Android development to C# programmers, Visual Studio

Unless you've been living on a planet far, far, away from the galactic trade routes, you know there are only two practical choices of programming languages -- Java and Objective-C -- for developing native mobile apps. If you are an experienced C# codesmith who wanted to try your hand at Android or iOS app development, you were out of luck. No longer: Xamarin 2.0, an SDK produced by Xamarin, allows you to write Android and iOS apps using C# code. Equally important, you can do this with Microsoft's Visual Studio.

The Xamarin SDK is based on an open source project known as Mono that allows Microsoft .Net applications to run on other platforms. Xamarin currently consists of class libraries, a C# compiler, and a virtual machine. The class libraries implement the core APIs of Microsoft's .Net 4.0 framework. The compiler complies with the C# 5.0 standard, and it has support for namespaces and assemblies. The virtual machine executes the Common Language Infrastructure bytecode generated by the C# compiler.

[ Also on InfoWorld: Programmer picks: 6 tools for rapid mobile development | Learn how to work smarter, not harder with InfoWorld's roundup of tips and trends programmers need to know in the Developers' Survival Guide. Download the PDF today! | Keep up with the latest developer news with InfoWorld's Developer World newsletter. ]

The Xamarin SDK also provides platform-specific frameworks that work with Google's Android APIs and Apple's iOS APIs. However, these frameworks are not abstraction layer APIs that only access a lowest common denominator of platform services. Instead, they provide "bindings" -- mechanisms that enable C# method calls to properly invoke native methods designed for use with a different programming language -- to the native APIs for each platform. The Android API binding frameworks are called Xamarin.Android, while those for iOS are called Xamarin.iOS. The result: Xamarin lets you write a native mobile app entirely in C# code.

To use the Xamarin SDK to its fullest, the app should be factored so that its UI code is uncoupled from its core algorithmic code. That is, you write the core algorithms with the .Net framework, then implement the native UI for each target platform using the Xamarin.Android and Xamarin.iOS frameworks. The factored design allows the app to be built and deployed on both Android and iOS devices, where the app's core code uses the native API of the target platform. This scheme lets you repurpose field-tested C# code and libraries. It also provides some flexibility in choosing how many of the platform's native APIs to use. For example, your app might draw on the .Net networking stack for network services or rely on the platform's own networking stack frameworks.

To develop your Android and iOS apps, you can use Xamarin's own IDE, Xamarin Studio, or stick with Visual Studio. The Xamarin IDE allows you to organize projects into solutions so that one build command will make both an Android app and an iOS app. The Xamarin IDE also lets you execute and debug code in simulators for each platform or on the devices themselves. There's no compromise if you prefer to develop in Visual Studio, as Xamarin lets you build, download, and debug app code on the target devices with Microsoft's IDE.

InfoWorld Scorecard
Capability (40.0%)
Support (10.0%)
Setup (10.0%)
Ease of development (20.0%)
Performance (10.0%)
Value (10.0%)
Overall Score (100%)
Xamarin 2.0 9.0 10.0 7.0 8.0 8.0 9.0 8.6
1 2 3 4 Page 1
From CIO: 8 Free Online Courses to Grow Your Tech Skills
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.