Will Xamarin Be the New De Facto Standard for Multiplatform Mobile Development?

August 10, 2016
by
Brian Oliver

Are you considering using Xamarin for mobile development? Cody Kremers explains some of Xamarin's features and how it might benefit you to give it a try.

Development

To be fair, I was a long time skeptic of Xamarin.  I wasn’t convinced that a catch-all platform would be able to meet the expectations of a “pro-native” developer.

I was familiar with the Xamarin concept for quite some time, but never considered it a viable option to use on a project.  But when I heard about Microsoft’s acquisition of Xamarin and its decision to make it open source, my curiosity took over. I started to play around with what the platform had to offer.

I found many things about Xamarin’s offerings that might make it the de facto standard for the future of mobile development.  Below, I’ve included a few simple examples, from a developer's perspective, on why everyone should think twice about Xamarin.

Language-level asynchronous programming keeps things responsive with ease.  Working with callbacks and managing calls can get gruesome.  Using “await” simplifies this process a bit:

<p> CODE: https://gist.github.com/thec2group-blog/f4ea7635f5b243da2cc8a0d618e73f73.js</p>

I quickly realized that having the ability to utilize C# and .NET has many advantages.  In Java for Android, lambdas are not an option by default.  In Objective-C, lambdas can be cumbersome.  However, in C#, lambdas are simple and elegant:

<p> CODE: https://gist.github.com/thec2group-blog/1334b03bc7ff6a1f320cc1d64010a425.js</p>

The example above shows the simplicity of functional programming as an option for all three platforms with one line.

Put these things together with some type inference and we can derive the example code below:

<p> CODE: https://gist.github.com/thec2group-blog/377b0351744a08b13d77eafc480c4702.js</p>

The developer part of me was sold.  But what about from a project management perspective?  Does incorporating Xamarin actually create a faster time to market?

For starters, Xamarin does not discourage each platform's origins and mannerisms or force commonality; the true Android experience or iOS experience remains intact.  This is one of the great features of Xamarin.  Each platform has distinct features, appearance, and behavior.  Xamarin not only recognizes this, but embraces it as part of the platform.

Obviously, Xamarin offers the standard .NET classes to build off of, but it also incorporates iOS-specific .NET classes and Android-specific .NET classes while keeping the native user interface.  Xamarin apps have access to the full spectrum of functionality offered by the underlying platform and device, including platform-specific capabilities like iBeacons and Android Fragments.

From my testing, the app's interface act and behave in the way you would expect them to.  Each of these offers the unique features of the respective platform.  The benefit is retaining the ability to share a common codebase, without losing capabilities the unique features of each platform.  Truly, a best of both worlds solution. While there is certainly a learning curve to any new technology, I think Xamarin can mitigate the complexity.

A C# .NET developer familiar with MVC concepts will truly feel right at home.  The ability to share a common codebase cuts development time by a good margin.  The user interfaces are developed independently, but this can be done with relative ease.  Xaml is also an option.  From a project perspective, utilizing Xamarin can also help cut down on bugs.  With all the business logic shared, it’s a once-and-done.