5 reasons to use Xamarin for cross-platform development
- select the contributor at the end of the page -
Recently Microsoft and Xamarin announced a global partnership that has both their technical and sales teams working together more closely. In addition, Xamarin now offers deeper integration with Visual Studio and produces fully compliant .NET Portable Class Libraries. Clearly Xamarin is a product to pay attention to.
If all that doesn't perk your interest in Xamarin, here are five reasons you should be using Xamarin for your iOS and Android cross-platform development.
1. Less to learn
Becoming an effective mobile application developer always involves a learning curve. There are things like process lifecycle, UI norms, the platform SDK, etc. that one must learn. Why add one or more programming languages to the already lengthy list of things you must learn?
If you're an experienced .NET/C# developer you will be immediately at home working with Xamarin. It provides a complete implementation of C# and incredibly thorough implementation of the .NET class libraries. It's not uncommon for well over 80 percent of one's existing desktop or server .NET/C# code to be compatible with Xamarin (your mileage may vary).
Even if you're not an existing .NET/C# developer, Xamarin will likely reduce the time you spend learning. Android and iOS normally require the use of two separate programming environments: Java and Objective-C respectively. Very few developers are highly skilled in both of these environments (yes, I know there are some of you out there) which means the overwhelming majority of developers will have to learn one or both of these environments before beginning a cross-platform project.
Learning the Java and Objective-C environments is not limited to just the programming languages. There's also the issue of the underlying core classes such as collections, etc. that will require you to understand two different ways of doing the same things.
Using Xamarin, you only need to learn one language, C#, and one core set of classes to be effective on both platforms.
2. No limits
One of the coolest aspects of Xamarin is that it doesn't try to force commonality where none exists. Both Android and iOS have UI and SDK features that are distinct to each platform's appearance and behavior. These features are central to iOS apps feeling like iOS and Android apps feeling like Android.
Some cross-platform application development tools attempt to hide platform uniqueness which results in apps feeling foreign to the platform on which they're run. Xamarin does just the opposite. Xamarin embraces the unique features of each platform.
In addition to the standard .NET classes, Xamarin includes iOS-specific .NET classes and Android-specific .NET classes, each of which expose the unique features of their respective platform. The combination of the core .NET classes with the platform-specific classes allows applications to share core logic across both iOS and Android while taking advantage of the each platform's unique features.
3. Faster time-to-market
Xamarin allows us to code application logic once and then share it across both iOS and Android. Compare this to working in the native environments of the two platforms where the logic must be implemented once in Java for Android then the same logic implemented a second time in Objective-C for iOS.
Put simply, using each platform's native development environment requires that we write more code. Writing more code takes more time. With Xamarin we're able to focus our efforts on building app features once and then shipping the app. Compare this to the native platform environments where we build the app features once for one platform, then we build them again for the other platform, and then finally we ship.
A quick note on the issue of time-to-market. Xamarin definitely reduces development time but I don't want to give the impression that it cuts development time in half. We still write some code that is unique to each platform such as when creating the UI or interacting with platform-specific features.
4. Fewer bugs
The number one reason that Xamarin tends to result in fewer bugs is the same reason that it provides faster time-to-market: we write less code. As a general rule, the less code we write the fewer errors we're likely to commit.
Xamarin also reduces errors by providing the opportunity for greater test coverage. Any given project has a finite amount of time available for testing. Rather than spending that time writing two sets of largely duplicate tests, we can write a single, more comprehensive set of tests that validate the code for both platforms.
Finally there's the issue of skills concentration. Working in the native development environments requires that one of two things happen. In one case, each developer on a team must split their time between the two environments providing less opportunity to become proficient in either environment. The alternative is to split the team so that each developer focuses on one platform or the other. The problem here is the team becomes artificially divided with each team member being limited to supporting and checking only those team members who work on the same platform.
With Xamarin, the whole team is able to focus entirely on working with .NET/C#. This allows each team member's skills to develop more fully and enables the team as a whole to better support and check one another.
5. Readiness for the future
Although Android and iOS are far and away the smartphone industry leaders, Windows Phone is rapidly gaining. Now I don't share the same confidence in Windows Phone as my fellow Pluralsight author, Lars Klint, but I do believe Microsoft is a company that can't be ignored. With the power of Microsoft behind it, Windows Phone has a real chance of being an important player in the smartphone race.
By using Xamarin to create our iOS/Android apps, we can have our apps ready to support Windows Phone without investing a single second in developing for Windows Phone. All of the shared logic we create for our iOS/Android app will be fully supported by Windows Phone as long as we indicate we would like that to be the case when we first create the project. This allows us to build our app without investing any energy in Windows Phone development. However, should a Windows Phone opportunity present itself, all we have to do is create the Windows Phone UI and our app now supports three smartphone platforms instead of just two.
Xamarin is gaining more attention everyday and with good reason. In a world where a variety of mobile platforms coexist, we need a toolset that allows us to support multiple platforms with minimal duplication of work. This just what we get with Xamarin.
To learn more about cross-platform development with Xamarin, checkout Jim's two Xamarin courses: Cross Platform iOS/Android with Visual Studio and C# - Part 1 and Cross Platform iOS/Android with Visual Studio and C# - Part 2.
Ready to test your skills in Visual Studio? See how they stack up with this assessment from Smarterer. Start this Visual Studio test now.