M2mobi - Xamarin: a solid cross-platform solution?
All blogs

Xamarin: a solid cross-platform solution?

Why invest in the development of a fully native app if there is also the possibility of a cross-platform solution? Here at M2mobi, we develop native Android and iOS apps for our clients, because we strongly believe in a fully native experience. However, we are seeing more and more developers making use of an increasing number of cross-platform solutions. Can they nowadays offer the same experience as native apps? And how could we use them within M2mobi?

Michael, Developer at M2mobi, has done extensive research in order to answer these questions.

Native and cross-platform, what is that?

At M2mobi we develop native apps. This means that a separate app version is developed for each platform (Android and iOS) and the appropriate development tools are being used as well. Java/Kotlin are being used for Android and Swift/Objective C are being used for iOS. When working with these specific tools, developers can use all features (of the operating system in question) in the best possible way. This is why native apps work well with the built-in functions of a device, such as the collapsing toolbars on Android devices, and for that reason provide a generally better UX experience.

Developers who choose for developing with a cross-platform solution only have to develop a single app which can then be used across different platforms. All cross-platform solutions share the same goal: quickly and easily developing an app for both platforms using a shared code base. That may sound like an ideal solution, but cross-platform apps usually experience a slower performance than native apps. In addition, cross-platform apps often experience problems due to device fragmentation. This occurs when users use an older version of an operating system, while other users use the app in newer versions.

When choosing between native and cross-platform, you weigh up the desired performance and budget.

img native crossplatform

Xamarin

One of those cross-platform solutions is Xamarin Native, a tool that has already proven itself as potential during one of our quick scans. When developing in Xamarin Native the frameworks of Android and iOS are retained and Xamarin.Android and Xamarin.iOS are being used as a framework. A second variant, where the platform-specific frameworks do not apply, is Xamarin.Forms.

Xamarin.Forms does not fit with the native development we apply at M2mobi. This variant of Xamarin is particularly suitable for 'basic' apps. More advanced features within Xamarin.Forms still require a native written code per platform. So you can ask yourself whether it is worthwhile to have a 100% shared codebase when native written code per platform remains indispensable. Besides, the .Forms community is very small and there is little online content available. Do you encounter a problem within Xamarin.Forms? Do not expect to find an answer with your first google search.

The research

Choosing Xamarin Native would be a good step towards efficiency and effectiveness. However, the question is whether this solution also meets the high-quality standards we strive for at M2mobi. As a result of that question Michael formulated the following, essential question:

How can Xamarin be used within M2mobi in order to share as many code between the native platforms as possible and at the same time comply with all existing standards for an M2mobi app?

To answer the question above, Michael first investigated which development principles and conditions are important when developing an app in Xamarin. These principles and conditions can be seen as a set of important topics that apply to the entire development process of an app - from development and testing to publication and maintenance. Only by doing research on all relevant topics, we could state whether Xamarin can be of added value during the development of a native app.

An example of one of these topics (principles) is the 'code inspection'. In order to develop a solid native app, two conditions must be met in the field of code inspection: enabling code reviews and performing static code analysis. Code reviews enable developers within a team to check each other's code to ensure the intended quality. Nevertheless, code reviews can not prevent that 'human' errors are made within the code base. The use of static code analysis tools can prevent this as much as possible. These tools include a set of rules that apply on the entire code base in order to prevent as many human errors as possible.

Once he has drawn up a set of required development principles and conditions, Michael has researched how this set can be applied to the various 'research objects'. To test Xamarin, a well-known app from M2mobi was used as a test object.

img xamarin

Results

Michael has developed a clear set of development principles and conditions that can be used as a basis for developing an app in Xamarin. Except for one, all principles and conditions can be implemented within a native development and can result in more efficiency. That single condition that's hard to implement within the native development is the use of static code analysis tools. These ensure that known errors from the development process are filtered. Another important result of this research is that an app developed in Xamarin Native is almost indistinguishable from a full native developed app for the end users.

Yet, a lot of platform-specific knowledge is needed, since it is not possible to work with just a shared code base. In order to develop a fully native experience for the end user, a project would still need both an Android and iOS developer. What it comes down to is that one developer writes a piece of shared code and another developer can profit from that code.

Besides the knowledge of platform-specific tools and Xamarin, a developer also needs knowledge of .Net (dot-net) and C#. When developing an app in Xamarin, you use the .Net framework and write the code in C#, also called the programming language. However, this does not have to be seen as a barrier, since these frameworks offer a lot of individual features.

Finally, account must be taken of the fact that the amount of shared code is variable. When an app contains few business rules and other divisible logic, the amount of shared code will be relatively smaller. If the User Interface is very complex and needs to be customized, this will require even more platform-specific code. Is time efficiency - and therefore a shared code - the main goal for the use of Xamarin? Base your choice on the UI complexity and the amount of business logic of the project in question.

Conclusion

Can we consider Xamarin as a solid cross-platform solution? Yes we can, Xamarin (Native) is a powerful tool and can often lead to a more time-efficient development. We emphasize 'often', as it still depends on each specific case whether Xamarin is the right solution. Next to the knowledge of the native development tools of each platform (Android and iOS), sufficient knowledge of .Net and C # is also required. Two other important factors are the UI complexity of a project and the amount of business logic. Are these respectively very complex and large? Then a fully native development still seems to be the most solid solution.

More articles

Be the first.

Get first access to special content such as whitepapers and blog posts.