8 Reasons to use Xamarin

This article describes Xamarin, emphasizing its key concepts.
By Adrian Mihasan Posted 10 January 2017

8 Reasons to use Xamarin

We all know that mobile development is at its peak now and even from the beginning, a cross-platform approach excited a lot of developers. Over the years, many such ideas were implemented and used; for 3-4 years now, the Xamarin trend showed up on the market as well.

As I had the chance and pleasure, I might say, to work with Xamarin a bit, I decided to share my thoughts regarding its development experience. Here are 8 things that I like about it and I find useful:

1. C# - one programming language, all platforms covered

Using .NET Framework, Xamarin is suitable to create applications for Android, iOS and Windows Phone. As a C# developer, I found this very nice, but it is still nice for someone who has to do an application for all platforms not having to change the development environment or programming language suddenly; this if you’re not an expert in both Java and Objective-C/Swift.

More than that, Xamarin combines the complete implementation of the .NET Core with the native specific SDK with only a little effort from the developer.

2. Support

These guys who started the Xamarin concept (Nat Friedman, Miguel de Icaza and Joseph Hill) have done a great job since 2011 and they managed to create and sustain an important community around their product. Xamarin has a very well organized documentation and training sessions grouped together in what they call Xamarin University.

We've got your back.

Xamarin Studio is the IDE they’ve implemented as an easy and pleasant development environment. It also contains the designer used to create native interfaces. There are the so called Xamarin Components (similar to nuget packages) which make developers’ lives easier as well.

The integration with Visual Studio started in 2013 and it was heavily increased from the moment when Microsoft bought Xamarin. This is how Xamarin comes now free with Visual Studio and offers access to all Xamarin Studio functions. This is a bit tricky when talking about iOS, where we still need a Mac to be able to build the app. But they are trying to enhance this experience as well.

3. Full native API access

Xamarin offers full access to the APIs and UI controls which iOS, Android and Windows Phone apps use when built on their platform specific environments. It uses native implementation for the most important APIs used, such as:

  • Bluetooth and Wireless
  • location Services
  • checking device orientation
  • Getting battery information
  • Text-to-Speech

The developers also take benefit of using the native controls for each platform, since Xamarin makes available the toolkits used by those three big platforms.

4. Huge amount of shareable code

Huge amount of shareable code

A huge benefit and the core of the cross-platform development the amount of shareable code between the platforms. Here is where Xamarin makes a big impact, being able share up to 96% of code. This is possible using two big approaches:

  • Shared Projects
  • Portable Class Libraries (PCL)

This increases the amount of reusable code together the use of interfaces and MVVM pattern which the guys from Xamarin recommend as the best practice in this case.

5. Xamarin.Forms

All that I told you above has being gathered into a single product which they call Xamarin.Forms. This approach is getting better and better every day and Xamarin invest a lot in it.

Shared backend

It is an architecture based on a PCL, where all the backend is managed and also a big part of the views is being handled. It allows the developers to use Xamarin Forms controls, which are rendered as native controls on each platform. The only code that is not entirely shareable is the one which uses the native APIs or needs complex native UI implementation. This code is handled by the specific platform projects which share the PCL.

This Forms concept started as an idea of creating POCs, but it was refined and it is getting more and more reliable in production as well. Let’s hope they manage to keep it going this way.

6. Native performance

The extra abstraction layer that I mentioned is one of the few things that make Xamarin not offering a full native performance. Even so, it is way above the competition represented by hybrid solutions. The performance metrics are comparable with Java, in terms of Android and Objective-C/Swift when talking about iOS. It has the advantage of continuous improvement and in my opinion, I can’t see another competitor in cross-platform development being able to obtain an almost native performance, as Xamarin does.

7. Xamarin Test Cloud

We all know how important testing is in software development. Xamarin knows this as well and that is why they put up Xamarin Test Cloud, a platform which allows testing application on multiple real devices in Cloud.

Xamarin Test Cloud

This feature has been improved a lot in its second version. If at first, the test were run from the command line, now they have a nice user interface and useful charts to render the results.

In order to encourage UI testing, Xamarin brought to market Xamarin Test Recorder, a nice small feature which is used for recording the touches on the device and converts them to code. This helps quite a lot the testing implementation.

8. Xamarin Insights

Last, but not least, Xamarin provides monitoring. Each published application is being monitored by the use of Xamarin Insights. All the logs are kept organized and presented on the Xamarin Insights platform. Also, graphs representing memory and processor usage are shown.

Conclusion

Fast, easy to use, well documented and with a highly increasing reliability, Xamarin is my number one choice when it comes up to cross-platform mobile development. I recommend anyone who is interested in developing mobile applications to give it a try, create some POCs, play with the Xamarin tools and taste the feeling of mobile world in C#.

Adrian Mihasan
Adrian Mihasan
.NET Developer