Introduction
I have written several articles relating to Xamarin.Android
, and most recently an Introduction to Xamarin.Android. In the comments, several people were asking what were the benefits to using a cross-platform technology such as Xamarin
. Why use a cross-platform technology? What are the benefits of using a cross-platform technology as opposed to developing apps natively?
In this article, I will outline the benefits of using a cross-platform technology as compared to native development.
Background
As I am most familiar with Xamarin
and Xamarin.Android
in particular, I will focus my article around those technologies. The arguments however could be equally well applied to other cross-platform technologies.
What is a Cross-Platform Technology?
Cross-platform is not a new concept. Cross-platform (or sometimes called multi-platform) when related to the field of computer software, refers to the interoperability between different computing platforms (or operating systems). The software is said to be platform independent. Before the mobile platform came along, cross-platform applications were those that could run on at least two of the following: Microsoft Windows, Linux / Unix, Apple Mac and so on.
A cross-platform technology is one that allows a single codebase to be deployed and run on multiple platforms. This is of particular importance in the field of mobile development where the multiple platforms include iOS, Android and Windows Phone.
A Brief History of Mono
Mono was initially released in June 2004. It is a free, open source project that is currently being led by Xamarin (and formerly by Novell and Ximian). Xamarin are a California based software company who created Mono
, MonoTouch
and Mono for Android
which are all cross-platform implementations of the Common Language Infrastructure (CLI) and Common Language Specifications (which are often referred to as Microsoft.NET)
The goal of Mono is to create a standard .NET Framework-compatible set of tools including (but not limited to) a C# compiler and a Common Language Runtime. One of the stated purposes of Mono is the ability to run Microsoft .NET applications on multiple platforms, i.e., to bring cross-platform to the .NET Framework and by extension to the .NET community.
Xamarin.iOS
and Xamarin.Android
, which are both developed by Xamarin, are implementations of Mono for iPhone and Android-based smartphones respectively. Unlike Mono itself, they are released under a commercial license only
Today's Challenge to the Mobile Software Industry
Currently, there are two major players in the mobile market - Android and iOS (although Blackberry and Windows Phone still need to be considered). As a software developer, the critical question is: how do you target multiple mobile platforms in a cost effective way. Time and money are finite resources that a business has to develop an application, and finding the solution that ensures the business targets the greatest number of platforms whilst simultaneously incurring the least time and money is a far from trivial challenge.
Any software company looking to target the mobile market will be facing the same challenge. There is certainly no magic bullet or one-size-fits-all solution. Every company has its own unique blend of resources, constraints, goals and ambitions.
Enter Xamarin
With the rapid increase in size of the mobile market, many (smart) software companies have added a mobile strategy to their already existing web strategy. This was particularly true of the .NET community. Companies that had investments in Microsoft products and technologies wanted tools that would enable them to target this rapidly growing market. This demand from the .NET community has been answered in the form of Xamarin
.
So what benefits does a cross-platform strategy provide, and specifically what benefits does Xamarin
give to a business looking to target multiple platforms?
Benefits of a Cross-Platform Strategy
- Greater reach. The greater the number of platforms you can target, the greater your potential audience and therefore the number of potential customers. As the mobile market expands on a daily basis, then so can your potential customer base.
- Develop once, deploy everywhere. The resources required (time and money) to build an enterprise application can be significant. Therefore to develop multiple applications for each platform increases these costs by the number of platforms you wish to target. No company has unlimited resources, and therefore any business that wishes to target the mobile market needs to find a resource-effective way in which to build these applications. Developing one application that can target all the major mobile markets is therefore a significant benefit.
- Single unified codebase. Having a single, unified codebase reduces your code maintenance tasks, such as your versioning and branching strategy, the number of source repositories you need to administer, a reduction in the time it takes to debug, fix, test and deploy defects (you only have to fix one codebase as opposed to multiple codebases).
Benefits of Xamarin
Xamarin
allows a .NET developer to target a platform that they wouldn't otherwise be able to (without re-training and re-skilling). This in itself is a significant benefit. The .NET community is a significant one, and the rapid rise in the mobile market provides significant opportunities for many of these businesses to create applications for these rapidly growing markets. Xamarin
allows businesses with existing .NET investment to leverage their existing investment and target a rapidly growing market.
As with everything, there is no such thing as a free lunch, and the ability for .NET developers to target mobile platforms is no exception to this rule. Xamarin
is a licensed product. Its pricing chart can be found on the Xamarin store.
There are separate pricing policies for start-ups and / or small businesses (defined at the time of writing as those that are either less than three years old or have fewer than 20 employees).
Disadvantages
Despite the benefits described here, there are disadvantages that need to be considered.
- The key benefit for cross-platform is to allow a business to port their existing business logic to multiple platforms. Therefore, cross-platform technology such as
Xamarin
is intended for enterprise development. If you are developing gaming applications where raw speed on the device is critical, then cross-platform (never mind Xamarin
) may not be for you.
- Although cross-platform tools such as
Xamarin
allow business logic to be ported across multiple platforms, they do not port the UI. So you will still need to duplicate the effort involved in re-designing the UI for each platform.
Summary
Hopefully, this article has given you food for thought. If you are in the process of deciding whether or not to invest in a cross-platform technology or go native, then I hope this has given you some discussion points. Feel free to leave a comment if you would like me to further elaborate on anything within this article.