Comparing five popular frameworks for mobile development in 2017

in Technology   —  

In part 1 of how to approach mobile development in 2016, we directly compared native vs cross-platform mobile development and highlighted that a hybrid approach can, in some instances, be a solution to provide a seamless mobile experience.

In part two, we are going to evaluate some of the popular frameworks you might use when the need arises for cross-platform development, helping you find what is best suited for your project.

Cross-platform frameworks

PhoneGap, Xamarin, Unity, Qt and Appcelerator Titanium are the frameworks that currently account for 80% of all cross-platform development for mobile.

top 3 cross-platform tools
Image credit: Vision mobile

The following table lays out the main characteristics of each tool:

Features

PhoneGap

Xamarin

Unity

Qt

Appcelerator  Titanium

Language

JavaScript, HTML5, CSS3

C#, Xaml

C#, UnityScript, Boo

C++

QML

JavaScript

Platform Support

Android, iOS, Windows Phone, Blackberry, WebOS, Symbian, Bada

iOS, Android, Windows Phone and Windows 8/RT

Android, iOS, Windows Phone, Tizen

Android, iOS, WinRT

iOS, Android, BlackBerry, Windows

Cost

PhoneGap Pricing
Free Plan: available

Paid Plan: from $9.99 p/m

Adobe Creative Cloud Membership: available

Xamarin Pricing
Xamarin Studio Community: free

 

Visual Studio Community: free

 

Visual Studio Professional: available

 

Visual Studio Enterprise: available

Unity Pricing

 

Personal Edition: FREE

 

Professional Edition: from $75 p/m

Qt Licensing

 

Commercial and open source

Appcelerator Pricing

Indie: $39 p/m

 

Team: $259 p/seat/m

 

Enterprise: available

Open source

Yes

No

No

Yes

Yes

UI

Web view

Native

UI Canvas

Native

Native

PhoneGap

PhoneGap makes it possible to develop mobile applications using industry standard web technologies (HTML5, JavaScript and CSS3). As a result it has risen quickly to become the most popular cross-platform framework, as it avoids the need to use native programming languages (Java for Android, Objective-C for iOS and C# for Windows Phone).

How PhoneGap works

An app developed using PhoneGap is structured as a fully native app into which HTML and JavaScript components are embedded as one or more WebViews. These WebViews are just thin containers, which can render a simple user interface using web technologies, and handle communication with the underlying device - to send a message, open the camera etc.

Additional functionality can be written as a plugin and then called from the WebView. PhoneGap provides a cloud-based service (called 'Build') to compile the application for each platform, avoiding the need to install the software development kit (SDK) for each platform.

PhoneGap can be used to build two types of applications.

  • Web Hybrid: used when you don’t need native UI elements, this way the whole application will be in one WebView
  • Native Hybrid: used when you do need native UI elements, this way the application contains several WebViews in the native container
Architecture of Web Hybrid and Native Hybrid PhoneGap applications
Architecture of Web Hybrid and Native Hybrid PhoneGap applications

Advantages

  • With simple APIs, developers who already work with HTML, CSS and JavaScript find it very easy to start developing with PhoneGap.
  • Anything already written as a web page can be quickly packaged into a mobile app, making it a useful tool for small applications and prototypes.
  • Plugins allow functionality to accesses the native device APIs
  • Supports all mobile platforms &endash; no need to install local SDKs as the cloud-based ‘Build’ service takes care of compliation.

Disadvantages

  • The user interface is rendered using an embedded browser. This gives a poor and slugging response compared to a native application.
  • The embedded browser behaves differently on different devies, so the user interface of the app varies.
  • Existing PhoneGap plugins are often outdated, so extending your application means writing your own plugins.
  • To get the most out of PhoneGap, developers really should know the coding language for each platform.

Xamarin

Xamarin is the second most popular cross-platform framework. Designed for the enterprise, apps are developed using a single, shared C# codebase. This is then compiled down into true native applications on Android, iOS and Windows Phone.

How Xamarin works

When using Xamarin, the code for the application is split by the developer into two parts: the ‘core’ and the ‘user interface’.

The ‘core’ part is made up of data storage, business logic code and the rest of the code that isn’t part of the user interface. A developer would write this code once and reuse across all platforms.

With the ‘user interface’ part, the developer would write the underlying code in C# and use native UI design tools to provide a different user interface layer specific to each platform.

Mobile application architecture with Xamarin
Mobile application architecture with Xamarin.

Advantages

  • A C# developer can create apps that look and feel like native Android and iOS apps with native UI elements.
  • You don’t need to know Java or Objective-C to create the final version
  • As Xamarin is based on ‘Mono’ framework,  you can use the .NET stack
  • It is connected with a growing community
  • Developers can use TestCloud to test their applications automatically.

Disadvantages

  • When you develop significantly customised UI or interaction, an internal Xamarin error appears citing compatibility issues, missing features etc.
  • As access to native platform features is carried out through a specific ‘*.dll’ you don’t have real control of what is being generated as the final code that will be run on the devices
  • The process of deploying the Android application to the emulator, or to the real device, is very slow.

Unity

Unity is a cross-platform game engine, popular among developers in the creation of mobile games and is one of the best tools for showcasing 3D content.

How Unity works

The developer uses C#, Boo or Unity Script, which is similar to JavaScript just with type annotations, to write the generic code for all platforms. Platform-specific code, such as native UI, is added as native code libraries.

Using plugins, Unity enables the native libraries to be wrapped into C#, creating a code bridge. By maintaining this wrapper, it opens up access to a wide variety of APIs, allowing communication with native, platform-specific code.

unity SDK

Advantages

  • Great option for making mobile games for a range of devices
  • Deployment to multiple platforms is easy to manage
  • The 3D engine gives high quality results without any complex configuration
  • There are a lot of good, free and reasonable priced plugins
  • Unity allows the developer to make their own shaders and change the way that Unity renders the game.

Disadvantages

  • Unfriendly User-Interface and hard to learn for beginners
  • Engine source code is not available. This means that, if a developer comes across a bug in the engine, he has to wait for it to be fixed or attempt a work around for the error
  • Unity’s compilers are not optimised for ARM processors for some mobile devices.

Qt

The next cross-platform framework on the list is Qt. With Qt, you write your code once, maintaining one codebase, and deploy across all screens and platforms, without the need for separate implementations on each device.

How Qt works

In Qt Creator, you can build applications for all compatible platforms. With Qt, the backend is developed using C++ and UI is developed on QML, which is a Qt-specific declarative language.

When it comes to platform-specific code, such as UI, the developer adds libraries for each language’s corresponding platform: Java for Android, Objective-C for iOS etc. Next, the library is wrapped in C++, giving the application access to the library API.

Qt SDK

Advantages

  • Qt has lots of good tools that are helpful for development, such as IDE QT Creator, Qt Designer and code profiling
  • It has libraries that contain intuitive APIs for elements like threading, networking, animations and more.

Disadvantages

  • Qt is difficult for beginners
  • For several applications, the developer will have to learn each platform’s APIs
  • Much less developers choose this option due to a small, active community.

Appcelerator Titanium

The final cross-platform framework we are looking at is Appcelerator Titanium, which can be used to develop cross-platform applications with native UI elements for all supported platforms using only JavaScript.

How Appcelerator Titanium works

With Titanium, the developer does not create web pages with HTML and CSS, but instead, builds UI using JavaScript code. The developer compiles the application for a specific platform in Titanium Studio, and can benefit from installing third-party, platform-specific SDKs beforehand.

At runtime, the JavaScript interpreter runs JavaScript code in an environment with proxies for the native objects, such as input controls and windows. The JavaScript command ‘create text field’ creates a native ‘UITextView’ for iOS and Android.

Xamarin
Image credit: docs.appcelerator.com

Advantages

  • The use of JavaScript allows easy development without the need to know platform languages
  • Native API usage gives access to iOS and Android features, meaing higher performance for applications that aren’t too large
  • UI is essentially native, Titanium applications feel and look better than apps built on other platforms
  • Appcelerator provides real-time analytics and a marketplace for third party components.

Disadvantages

  • There are delays when the application starts up due to the library loading
  • Development of complex applications is difficult, because JavaScript usage negatively affects application performance
  • “Appcelerator supports only common across all platform features”
  • Developers are required to manage target platform SDKs locally.

Takeaways

There is no perfect solution – as all frameworks have their pros and cons. For very simple apps it is possible to get away with using PhoneGap as long as responsiveness is not a key criteria. For more serious development we recommend using Xamarin and even then, consider combining Xamarin with native development for all user interface elements.

Read next