For Mobile Developers: What is Xamarin and Why Use It?

In this article, we provide an introduction to Xamarin and its appeal to mobile developers who are building cross-platform mobile apps.

Xamarin delivers high performance compiled code with full access to all the native APIs so you can create native apps with device-specific experiences. Photo: Xamarin inc.

Xamarin delivers high performance compiled code with full access to all the native APIs so you can create native apps with device-specific experiences. Photo: Xamarin inc.

Xamarin is a framework for cross-platform mobile app development in C#. The way it works is simple – you write one shared C# codebase with full access to all SDK possibilities and native UI creation mechanisms, and the result you get is a mobile app that looks and feels completely native.

A while ago a range of frameworks (like PhoneGap) that offered development of cross-platform apps on HTML5 using JavaScript got quite popular. The idea is that the app is developed as a regular website for mobile devices using appropriate js-libraries, for example Jquery Mobile.

Then the whole thing is packed into a container that looks like a native app. The disadvantages of this type of apps are pretty obvious. Number one, you don’t have access to native UI elements.

Number two, you get a cut and generalized API, therefore, some features peculiar to one platform or another will be unavailable. Number three, such app physically runs inside the phone web browser (WebView controller to be more precise). And you know what that means: the app runs slowly and looks ugly.

Xamarin is different. It is based on an open-source implementation of .NET called Mono. This implementation includes its own C# compiler, development environment and main .NET libraries.

There is a key difference between iOS and Android when it comes to apps performance – it’s their preliminary compilation. On Android devices virtual Java machine Dalvik is used to run the apps.

Native apps written in Java are pre-compiled into bytecode, which Dalvik then interprets into commands for processor when the program is running.

This is so called Just-in-time compilation. The compilation on iOS devices is called Ahead-of-time compilation. Xamarin takes care of this difference and provides individual compilers for each platform, so you get a completely native app as a result.

Xamarin allows using native UI development mechanisms and native UI elements for each platform, which doesn’t really go along with the Xamarin creators’ claims that it is an instrument for cross-platform development  (an app written once will run on different mobile platforms).

Here is an explanation. The only layer that you’ll have to write specifically for each platform is the UI layer. That’s the price you pay for being able to use native UI creation mechanisms.

Xamarin has its own store with third-party components – Xamarin Components. It is integrated in the IDE and it allows adding different components, written by Xamarin experts as well as third-party developers.

You’ll have to pay for some of them, but the majority of the components are free. Not all elements are cross-platform though, many of them are available only for a specific platform.

As a development environment Xamarin developers suggest using either their own IDE – Xamarin Studio or Visual Studio as a part of business-license.

Xamarin technology is currently a serious instrument for solving difficult tasks in the domain of mobile app development. The team of Xamarin developers never stop working on improving the framework. The technology looks very promising, as the number of developers choosing to develop with Xamarin are increasing every day.

You can download the framework on the official website – www.xamarin.com.

Share this article

We welcome comments that advance the story directly or with relevant tangential information. We try to block comments that use offensive language, all capital letters or appear to be spam, and we review comments frequently to ensure they meet our standards. If you see a comment that you believe is irrelevant or inappropriate, you can flag it to our editors by using the report abuse links. Views expressed in the comments do not represent those of Coinspeaker Ltd.