Pierre-Yves Schütz , 15.11.2018
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.
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 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.
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.
Figure 2: 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.
Figure 3: Flutter (https://flutter.io/technical-overview/)
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.