The truth behind the Mobile Frameworks war

Learn more about Velocity Partners offshore software development company.

Native Versus Hybrid Mobile Frameworks

During my years as a mobile development consultant, I’ve heard the same question arise over and over again: What mobile framework should we use?

Back in the day, Blackberry had a competitive market share and was one of the target platforms for serious mobile developments. Fast forward to today: Although the primary framework options remain the same (native apps versus cross-platform frameworks), the past decade has brought many improvements.

The Native Apps Framework Approach

The native apps solution, in which the developer builds an app for each platform, is considered by many to be a clean, user-friendly option. The primary advantages of this approach are performance and resource optimization. An app runs fastest when working through its native runtime system. Speed is a key facet of resource optimization—an element that is often overlooked when evaluating a new mobile development.

Each mobile operating system (OS) has its own way of using (and saving) resources. In general, an OS will try to automatically suspend apps that have started but are no longer in use, but there are many subtle differences in how OSes handle app resource management.

Depending on your app, you may need to alter the way the OS handles your app’s resources—and that can only be done in native code.

It is worth noting the disadvantage to this approach: You need to have different codebases for the different platforms, each written with a different programming language. This can make it difficult to add new features and maintain different bug-tracking processes for each codebase.

Apps Face Growing Pressure for Platform Flexibility

With growing pressure on companies to develop “solutions” instead of apps, some cross-platform mobile frameworks emerged to allow a single codebase to run in a mobile-platform-independent framework, as well as APIs that can run on different platforms. This trend illustrates the primary advantage of the frameworks described in this post: They allow for a single codebase and single APIs that can adapt to various configurations.

In practice, however, the same code does not always run in the same way on all platforms—this is especially true for APIs that try to encapsulate complex modules (like accessing Contacts or wanting to deal with non-standard touch events). In these cases, many APIs have options/configurations specific for a particular platform, but still use one codebase and one language.

Also, some frameworks allow the use of a hybrid app, with some parts native and some parts cross-platform. However, this method can introduce the need for native code, as well as native language and native libraries.

Cross-Platform Mobile Frameworks

Apache Cordova is probably the most popular and one of the first cross-platform frameworks. First known as , it was later an open-source version called . It soon became the base for many derived projects (including PhoneGap itself, which still exists as a productized version and ecosystem on top of Cordova). You can read more about the history of Cordova .

Cordova encapsulates the app as an HTML5/CSS/Javascript Web app that runs in a native Web view on the target platform. In practice, all front-end code is not sluggish—as one might expect—because it generally runs in a hardware-accelerated Web view. General data processing code is slow, as it needs to execute via its JavaScript engine on top of the native platform.

Derivative Works

There are many higher-level frameworks that have particular APIs (mostly front-end) and tools to create cross-platform apps while using Cordova as their core. Among them are:

React Native for Building iOS and Android Apps

is a framework for building iOS and Android apps using JavaScript and React. Both of these projects were created and maintained by Facebook and are used with many of its products. While React Native is a relatively new framework, it has gained a lot of acceptance from the community and is widely used. In this framework, you can use standard components such as UITabBar on iOS and Drawer on Android. This gives your app a consistent look and feel with the rest of the platform ecosystem. It also means that you need to maintain different code for each platform. But since everything is still on JavaScript, you can use the same business logic code on both platforms. This framework also allows you to create native modules and views on both iOS and Android.

Xamarin

The framework has a totally different approach. It is built on top of , which is a cross-platform, open source .NET development framework. This configuration allows you to code your mobile app using C#, use native UI components or shared Xamarin.Forms using 100% shared C#, and deploy on iOS, Android and Windows phones.

Comparison chart

Below is a list of features intended to help developers see the different options when choosing a framework:

Feature Android Native iOS Native Cordova React Native Xamarin
Programming language Java Objective C, Swift, Swift 2 Javascript Javascript C#
Development Tools/IDE Node.js Node.js or
Platforms Supported for Development Tools Win, Mac, Linux Mac Win, Mac, Linux Mac (experimental Windows and Linux support for Android) Win, Mac
Target Platforms Android iOS Android, iOS, Windows Phone 8, Blackberry, Windows 8, Amazon FireOS, Firefox OS Android, iOS Android, iOS, Windows Phone, Mac, Windows

 

There is no one-size-fits-all mobile development approach. While native app development is better in many cases, the broad range of mobile framework options we have today fare better in others. The ultimate decision should depend on the particular requirements of the project and should be carefully evaluated depending on performance needs; development language/technology/platform preference; team size; collective knowledge and the time frame of the project.

Sebastian Decima

Technology and Software Engineering Consultant at Velocity Partners