Effective cross platform development in practice - the technical perspective
What is it?
Wortell has developed an app, targeting all major platforms, which is intended to be used by Dutch delegates of Microsoft's World Wide Partner Conference (WPC) in 2015. In the past visitors of the event received a printed booklet with all the relevant information, this year the app will provide easy access to the conference information, as well as contact details to enable delegates to easily network with each other.
What technologies are we using?
The mobile apps have been built using Xamarin.Forms, a technology which enables the building of native apps for iOS, Android and Windows Phone from a single, shared codebase.
As usage will increase significantly during the 4 days of the conference it is a critical requirement that the backend is able to easily scale up during times of high usage. For its reliability and scalability we chose to implement a cloud based Microsoft Azure Mobile Services backend.
Unique experience for each platform
A great design from a user experience (UX) perspective is one of the key ingredients in a cross platform project for both the end user and for a successful development process.
For users, this will ensure that we have the best possible engagement by delivering an authentic native experience while taking full advantage of the benefits of each platform.
For the development process, this will ensure an efficient path forward without having to occupy costly development resources writing time consuming platform specific customizations.
One of the dangers with cross platform projects is that once the codebase starts diverging with elaborate platform specific customisations, the project can quickly become over complex and eventually turn into an unviable project.
Fortunately with Xamarin.Forms there are a wide variety of standard user controls available that are rendered appropriately for each platform. Properly planning the WPC 2015 UX design around smart choices like these contributed to a high level of code reuse without compromising on the end users experience.
For example, the single implementation of the main view of the app is shown in the screenshots above, rendered using native controls on each platform:
- The menu is rendered as a pivot view on Windows Phone and tabbed views on Android and iOS.
- The search boxes are native, noticeable by the inclusion of the relevant icons, behaviours and on screen keyboard (OSK) configuration for each platform.
- The ListView is one of the more complex elements of the app and even this is 100% shared code with platform specific features such as the LongListSelector on Windows Phone and the Jump List and separator line on iOS.
Benefits/ Trade- offs
One of the main benefits of this approach is that we enable our customers to have broader reach while providing the same native solution at a lower total development cost.
From a technical point of view the maintenance and consistency of the codebase is a significant improvement over having to deal with multiple native projects. Developers are happy and more productive when we are able to use our favourite Microsoft tools such as Visual Studio and languages such as C# and Xaml, even for other platforms. The trade-off is that although developers are using the same languages as a pure native Windows Phone project (C#/ Xaml) we are actually dealing with a different underlying API and that takes some getting used to.
Regardless of the technology in question when attempting any cross platform project you are forced to deal with the quirks and pitfalls of each platform, their devices and store submission requirements. As any developer can tell you this always leads to unexpected issues that need to be dealt with.
While Xamarin.Forms is moving towards a higher level of maturity there are some stability and performance issues. It can be risky introducing a dependency on a key element of the project that is outside the direct of control of the development team.
For Microsoft, the WPC 2015 Deelnemers app is a successful cross platform native implementation with well over 90% code reuse. While there are some performance trade offs, Xamarin.Forms is reaching an acceptable level of maturity to viably use in some commercial projects.
Note: This blog post deals specifically with Xamarin.Forms, the choice of technology for this particular project. This is a subset of, and should not be confused with, the full Xamarin API. In other scenarios using different technologies, certain constraints or considerations would not apply.