Native App Development vs Xamarin vs Xamarin.Forms


Before start creating a Mobile Application there are a lot of considerations that we have to think about, there are some options that we can choose to start developing our app, but the first question is: Native or cross-platform? but even in cross-platform there are some options, the Native and the Hybrid cross-platform development, the truth is that users prefer Native apps over the Hybrid (websites packaged into a native wrapper), if you want more info about this debate Native vs Hybrid. In this post we are going to focus only in Native mobile development, so lets get started.

Native


Native Apps are build using tools, SDKs and their specific programming languages which are supported by a particular mobile OS, e.g. Android - Java, Windows Phone/UWP - C#/VB.Net/C, iOS - Objective-C/Swift. These Apps are built from scratch with the intention of operating on their designated platform.

Pros

  • High Performance
  • Code optimized for OS
  • Native UI (Flexibility)
  • Direct Access to all APIs
  • Very responsive look and feel

Cons

  • Time consuming
  • Specific skilled developers
  • Different codebases (very low code recycle)


Most people says that Native is always the best option for mobile development, since it has some advantages compared with any cross-platform development tools out there, so, beside the pros mentioned above there might be others such as the app size, using Native you can get a small size compared with an App made in Xamarin, since in Native there’s not an intermediate framework or extra libraries (.Net, System), however, if you are creating a multi platform app (iOS, Android, UWP) using Native you will have 3 different codebases made in 3 different frameworks and tools, so the development might take longer and maintenance become a little bit more complex since each change, fix, improvement needs to be done separately.

Xamarin.Platform (Native)


Xamarin.Platform basically wrap the standard Android and iOS platform APIs, they allow apps to be written in C#. The UI are created in the same way you would develop a Java Android app or a Swift/Objective-C iOS app, meaning that it can create almost identical apps that in the Native development regarding UI and similar performance.

Pros

  • C#/.NET has any good libraries
  • Same codebase for all platforms
  • Code recycle up to 40%
  • High performance
  • Flexible UI Design (very similar than native UI Design)

Cons

  • Bigger app size
  • Hard to find third party libraries
  • Versatile skillset required (C# . net and Mobile development skills iOS/Android)


Xamarin.Platform or Xamarin Native as most people know it, is the real Xamarin, or is the way how Xamarin started at the beginning, basically creating Apps in the same way (UI design, patterns) as in their Native way, the IDE contains a designer very similar than Xcode or Android studio that allow the developer to create their screens easily.

As mentioned above when we use Xamarin.Platforms to create our Apps, we can use C# for everything, meaning that we can have some code that we can reuse throughout the different platforms (Business logic, backend or separated functionality) some people mention that the code recycle can reach the 50%. We shouldn’t forget that in this approach we need to create separated the entire UI for each platform.

Xamarin.Forms


Is a framework that runs on top of Xamarin.Platform allowing a single XAML or C# UI to be written to target several platforms at once. it doesn't give you all the UI control and flexibility (directly) than the others, but you can create specific UI using Xamarin.Platform and use it in Xamarin.Forms (custom renderers).

Pros

  • C#/.NET has any good libraries
  • Same codebase for all platforms
  • Same UI for all platforms
  • Code recycle up to 90%
  • Medium/High performance

Cons

  • Bigger app size
  • UI Control (often need for custom renderers or third party libraries)
  • Hard to find third party libraries
  • Need to create custom renderers (platform specific functionality that require Platform specific skills Android/iOS)

Xamarin.Forms was released in May of 2014, it has almost 3 years of existence, at the beginning it was intended to be for prototype Apps or simple applications that not require intensive UI, however it was very well accepted by the community, since it allows you to create Native applications with a decent performance and even when there are some limitations in Xamarin.Forms, it has some mechanisms to workaround or extend functionality or even UI using platform specific code (Creating custom renderers using Xamarin.Platform).

So, Basically Xamarin.Forms is a cross platform UI layer over the Xamarin.Platform, making a bit easier the creation of Mobile applications, targeting multiple platforms.

Using Xamarin.Forms you can create applications more sophisticated that only prototypes or simple applications, I’ve been reading and listening people from Xamarin saying that now almost 3 years from XF release, you can create fully functional applications with a decent performance, actually since the Xamarin acquisition by Microsoft, they have been focused on stability and performance as you can see on this link:

Xamarin.Forms feature roadmap
https://forums.xamarin.com/discussion/85747/xamarin-forms-feature-roadmap/p1

In short terms, right now (March 2017), the Xamarin development team is highly focused in quality (stability and performance), I will list a few topics that the Xamarin guys are working now for Q1 and Q2 of 2017:

Startup Time Improvements - Performance
Improve the startup and initialization time for Xamarin.Forms apps.

XAMLC Enhancements - Performance
Approaching full support for currently supported XAML features. Compile time support for all value providers.

Compiled Native Views - Enhancement, Performance
Bring native view declaration to XAMLC, so users don't have to opt-out of XAMLC in PCLs where pages use native view declaration.

Fast Renderers - Performance
Label, Image, and Button controls.

Layout Compression - Performance
LayoutCompression allows multiple layers of Xamarin.Forms layouts to be packed into a single native one.

These all are about performance, high priority this year, however there are also some new Features as well that will help developers to create fully functional real world applications using Xamarin.Forms.

Conclusion

Lets be clear and honest, Native apps are great, you can get an amazing performance, probably a small package size (compared with Xamarin), you can create a very fancy UI with lots of effects and animations, however is more expensive in time and money (thinking on creating an App for each different platform), in the other hand we have the most powerful Native cross-platform development framework, Xamarin, that in both versions Xamarin.Platform (Native) or Xamarin.Forms you can create great Apps with a very similar performance.

References:

Xamarin Forms vs. Xamarin Native UI
https://crswlls.wordpress.com/2016/11/15/xamarin-forms-vs-xamarin-native/
https://thedon.me/2016/10/06/xamarin-forms-vs-xamarin-native-ui/

Why Xamarin
http://insanelab.com/blog/mobile-development/xamarin-mobile-application-development/

Xamarin vs Native
http://www.mobiloitte.com/blog/xamarin-vs-native-mobile-apps-4-things-keep-mind

Nativescript vs Xamarin (this has a speed comparison at the end)
https://www.nativescript.org/blog/nativescript-and-xamarin

Popular posts from this blog

Creating a Movie search App with Xamarin.Forms and Prism

Xamarin, Getting up to speed!