Cross Platform Development

Development of mobile applications running on different platforms is always a matter of tradeoff.

An obvious approach is to design a native application for each desired platform. This implies developing and maintaining a code base in a different programming language for each of them: Java for Android, Objective-C or Swift for iPhone, C# for Windows Phone.

Making mention of Windows Phone, Microsoft communicated last year that they are not going to invest any more in new features or hardware for their mobile platform, de facto announcing the death of the Windows Phone. Even though it never gained a large market share, mobile cross platform nowadays definitely means support for Android and iOS.

An alternative is to deploy a hybrid development framework such as Ionic or Apache Cordova, based on the web technologies CSS, HTML5 or JavaScript. Following the ‘write once, run anywhere’ precept, a single code base can be used for all platforms. The UI elements are rendered as HTML pages, leading to a performance hit and a different look and feel than with native apps.

In between, there are a few toolkits that promise the best of both worlds: a single stack of technology for all platforms, access to all the native APIs and widgets for the developer, and a familiar user experience for the end user. The most mature of them, Xamarin, has been around since 2011. Other solutions such as React Native and Flutter are also worth mentioning.

Xamarin

Xamarin

Xamarin runs on Mono, an open source and multi-platform implementation of the .NET Framework. Microsoft has acquired the company behind Mono and Xamarin in 2016 and massively supports and advertises the toolkit ever since. Applications for Android, iOS and Universal Windows Platform are built using C# and Visual Studio.

Using Xamarin.Android and Xamarin.iOS products, only the business logic can be shared, limiting the potential for code reuse since a specific user interface must be created for each platform.

With Xamarin.Forms the user interface can also be shared across platforms, typically allowing between 80 to 90 percent of code reuse. The UI layer is described with XAML in a very similar way as with WPF. The performance is close to native apps and the controls are rendered as native widgets. Moreover, Xamarin has full access to the Android and iOS standard libraries. The app is larger than a native one, because the .NET Framework (stripped from all unused libraries) is enclosed with it. This means that the .NET virtual machine runs on top of the Java virtual machine. For demanding applications such as games, the performance penalty of Xamarin over a native app might thus become significant.

React Native

React Native – developed by Facebook – is based on React and JavaScript. Contrarily to most of the other frameworks using web technologies, React Native does not render user interfaces through HTML pages, but with native widgets. With applications built for Instagram, Tesla or Skype, React Native has now became a well-established technology, with a large and dynamic community inherited from ReactJs.

From a developer point of view, the framework is still in evolvement and apps must be regularly updated to comply with the latest version. However, it provides a functionality that Xamarin developers have been dreaming of for a long time: hot reloading, the possibility to modify an app and reload it instantly – within one second – preserving the state of the application in the process.

 

Google trends worldwide for Xamarin, React native and Flutter (retrieved on 11th October 2018)

Flutter is a free and open source framework developed by Google, the creator of the Android operating system. Apparently, Google developers were so tired of writing all of their apps twice for Android and iOS, that the company developed its own cross platform solution.

This technology is still quite young, and as of October 2018, the current release is still a ‘Preview release’, which makes it hard to anticipate how strong Google is going to push and support this toolkit. Nevertheless, some voices don’t hesitate to claim that Flutter is the future of mobile development, and that Dart, its programming language, is the next one you should learn.

Indeed the toolkit looks very promising. Flutter aims to provide high performance to users, and an unmatched productive development environment – including hot reloading – to developers.

Mobile development at CSA Engineering

At CSA Engineering, we primarily work with Xamarin for any mobile development. As a company that has been using Microsoft products for many years, our .NET developers were able to easily and quickly pick up this technology stack. However as there is no perfect technology for all projects, we definitely keep an eye on promising technologies such as React Native and Flutter.

Kontaktiere uns