The Case of Xamarin – For cross-platform Mobile development
As an enterprise mobile developer, at some point, you would be faced with the decision to choose a cross platform development tool. Remain native and manage its challenges (which are elaborated a bit later) or go hybrid with tools like PhoneGap (Based on open-source Apache Cordova) or go with HTML5 and its related libraries?
As you might have guessed, there is certainly no right or wrong answer. The answer depends on what is the problem you are facing or trying to solve when you started looking at a cross-platform development tool.
Most-often, HTML5 based development or hybrid development tools seem to be advocated as the panacea for all problems faced by native development. So, what are the typical problems that continue to haunt if we were to take the native development route for Enterprise Apps? I specifically say “Enterprise” apps and not gaming apps (since gaming apps most often need not have custom UI per platform)
The problems could be of:
· Managing a large number of code bases – for Android, iOS, Windows, for smartphones, tablets, mini tablets, TVs, including some variations if you are targeting different countries.
· Adding new features to the many code bases that exist
· Fixing bugs in each and every code base
· Testing all the code bases for each feature enhancement or bug fix
· Ensuring features are in parity in the large number of code bases
· Giving a standard experience on each of them
In short, the problems are all related to the growing number of code bases each time we target a new device form-factor or platform or country.
HTML5 or hybrid apps could bring down the number of code bases. Infact, they have matured over the years to be able to give most of the features that native apps support. They are positioned as “write-once-run-anywhere” solutions.
However, one fundamental question you have to ask yourself is whether you are looking for an app with the exact same User-Interface (UI) on Android, iOS, Windows etc.? If you are looking for platform-specific UI paradigms, you will have to do a lot of branching in the code – which very soon can become a nightmare. Your entire view layer code would be filled with branches on platform specific UI!! That certainly was not the intention when you chose a cross-platform tool!!
This may not be too different for the hybrid route too. You also have to deal with the lowest common denominator of the UI features supported by the cross platform tools. So, if you intend to give native UI feel and features without being stuck with the least common denominator of features for your app and without having to do platform specific coding through “if…else” branches in your code, you must take a look at Xamarin.
Xamarin is the cross-platform tool that has addressed this very problem in a very elegant way!! It makes an assumption or advocates that you develop all the backend pieces of common, non-UI code in a separate layer and you write your platform specific UI in a separate layer. Considering such a design, Xamarin gives a complete set of platform specific features to you through the platform specific SDKs. You have the Xamarin.Android and Xamarin.iOS, which give you a 100% support to every feature on their specific platforms. But you also have Xamarin itself with out platform dependencies that can be used to build all the non-UI logic and reuse it across platforms – giving you the advantages of cross platform development but also giving you’re the advantage of native development of UI !! Howzat?!! And since this is developed using C#, you are almost ready to deploy the same code with UI development specific to Windows on Windows mobile as well!!
Based on my experience in mobile app development, typically about 60% to 705 of the code is non-UI in enterprise apps and that is what lends itself to reuse.
Sure, it is now giving a “write-once-run-anywhere” assurance. It requires you to develop UI specific to platforms. Infact, what can be touted as its biggest limitation – having to develop UI separately for each platform is what I term as THE biggest advantage in enterprise apps that want platform-specific UI but cross-platform development!
Sure, any solution is suitable only considering the problem you are trying to solve. So, take an informed decision J
Check it out at Xamarin.com.