A Developer's Perspective on Hybrid / Cross-Platform App Development vs Native App Development
Perspectives on Hybrid / Cross-Platform App Development differ vastly depending on who you speak to. A client who invests in custom mobile app development may look for a solution that will reduce the total cost of ownership; on the other hand, a developer involved in mobile app development may not care about the development cost, but instead may focus on the ease of maintaining and developing new features on the app.
For some background, I have been developing mobile apps using native frameworks for quite some time and may be biased in my judgement. But recently, I had an opportunity to develop mobile apps using the Cross-Platform App Development Framework--Xamarin and native apps--using both Android and iOS frameworks. As a mobile app development company, we are often asked whether to use Cross-Platform App Development frameworks such as Xamarin, Cordova, Sencha, Ionic, and others, or develop an app using native Android app development and iOS App development frameworks. Clients want to know whether they need to develop two separate apps or just one app for both the platforms. In the following paragraphs, I will document my development experience on both platforms and give a developer's perspective on which is the best mobile app development approach.
One of the common arguments for using Cross-Platform App Development frameworks such as Xamarin is that the code can be created or written in one programming language and then easily deployed across multiple platforms (a single code base for both iOS and Android). This sounds great from a client perspective, as it means lower development costs up-front. However, it doesn't hold true: development on Xamarin also takes a long time to reach a stable state, and needs more skilled developers than may be needed with native app development. When one looks at the pros and cons between the two approaches, despite higher investment upfront, businesses are better off developing native mobile apps rather than using Xamarin, as the total cost of ownership is less in the long run.
But why is that the case? Here are a few reasons:
The greatest advantage advertised for Xamarin is that it promises one code base, but in reality, it's not a single code base in a true sense. Xamarin provides a very good mechanism to create common modules, and thus can be reused across platforms. You can keep business logic, service integration, and models in common module. However, when integrating data with your UI, you need to write platform-specific code. UI and data binding are not the part of the common code base.
So what is the actual amount of code reuse that we get using Xamarin?
The answer depends on the nature of the apps we create. If we have most of the business logic on the client side, we save a lot of rework by using Xamarin. However, if the majority of the business logic is on the server side, we don't save much in terms of reuse with Xamarin.
Given the popularity of iOS and Android App development frameworks, there are hundreds of third-party libraries, especially UI components, that are available easily and, as a developer, I am used to integrating these libraries without great difficulty. However, when we try to use certain third-party libraries in Xamarin, it is not such as easy task. Even though Xamarin offers bindings for some of the more popular libraries, bindings are not available for most of the libraries, including some of the more popular ones. This means that they need to be created by the developers, which has negative impact on the development timeline.
Ease of App creation
In the example of iOS, the whole application can be designed using storyboards. Xamarin does have something similar, but it doesn't have the exhaustive features of storyboard. Designing UI using Xamarin studio is a tedious task, compared to XCode storyboards. The Xamarin website itself recommends using storyboards to design the UI, followed by importing the UI into a Xamarin project. But is it worth going back and forth between environments? Developers may be better off sticking to one environment for development completely.
Performance and Size
Although the performance of Xamarin apps is quite good, it still lags behind native apps, especially since Xamarin creates native binaries and stores them. The native binaries have wrappers to run C# code on Android and iOS devices, which means that Xamarin apps are larger and occupy more space than native apps. This means that the apps are slightly slower and occupy more storage space on the phone.
Sharing of code outside of Xamarin
If you are choosing Xamarin, as a developer, you are locked into the platform. Since developed code cannot be reused within the Xamarin environment with either the native development team or as a plugin to hybrid app development team, this limits overall code reusability.
It is difficult to get high-quality Xamarin developers, compared to iOS and Android developers. Developers are needed who know Java, Objective-C or Swift, Android framework, iOS framework, and C# to develop apps in Xamarin. It would be difficult to keep the development costs low with this type of skill requirement.
The licensing cost of Xamarin is comparatively high as compared to iOS and Android frameworks, which adds to overall development cost for a client.
One of the main drawbacks of Xamarin is its limited UI abilities. While you can develop most of the native UI elements with Objective-C / Swift for iOS or Java for Android, for apps that are UI-rich, Xamarin is not the best option. This manifests in the form of feature incompatibility, missing features, UI inconsistencies, and more. Developers would then need to spend more time on developing separate UI components for iOS and Android.
The user experience is not as good for Xamarin as it is with iOS and Android Apps. Building a user interface for two different platforms is very difficult. Since both iOS and Android have their own human interface guidelines, supporting them with a single code base turns out to be very challenging.
The Million Dollar Question: Should I Use Xamarin For My App Development?
As a developer, it's a tough choice for me to say that I will create my app using Xamarin over native apps. The ease of app creation alone tilts the balance in favor of native apps. Additionally, the trade-off between development cost and maintenance cost means that the total cost of ownership for native apps, in the long run, is less compared to that of Xamarin. If a client wants to develop a Minimum Viable Product, and wants to test a limited private market on the viability of the app, a hybrid platform like Xamarin may work well. But, as a developer, I would always recommend developing native apps separately on iOS and Android platforms.