The UI must be implemented in C#
Xamarin — Cross Platform Mobile Development (2/3)
The concept of Xamarin as a Mobile Cross Platform Development toolkit can be best summarised with following statement:
Create native iOS, Android, Mac and Windows apps in C#
This is a post of the blog series “Xamarin — Cross Platform Mobile Development”. Part one can be found on Build Once, Deploy Many — Xamarin Cross Platform Mobile Development (1/3)
Therefore the development of applications for all three platforms is enabled in one single language — C#. This on its own is already a huge advantage compared to platform specific development. Despite Java, Objective-C and C# know-how, only the latter is required.
The concentration on C# as a unified language is enabled by embedding of the whole .NET Runtime Mono (mono-project.com) within each app-bundle. The Runtime takes over the execution of the final iOS ARM Binary or Android APK without cross-compiling and usage of an interpreter. Sever performance shortages are not perceivable despite of a comparably slower initial app launch. The slower app launch is caused by proportionally increasing footprint along with the number of linked API’s (min. 2.5 MB).
Against all expectation Xamarin does not ultimately search for a common factor / similarities of the various platforms. Furthermore it does not need too strong abstraction. Xamarin does rely on Native-Bindings that keep providing any kind of native functionality as direct as possible. With this it is theoretically possible to implement anything platform specific also with Xamarin in C#. The disadvantage is that platform specific detail know-how remains required.
Along the Cross-Development-Idea any business logic is — or will be — completely stored in a Shared Library. This Shared Library will be integrated in the client implementation of all platforms. Solely with that a Code-Reuse of 50% is accessible.
However, the UI has to be platform specific developed. Thereby Xamarin is completely different from other development tools. With that approach, a specific additional effort and a platform specific UI Implementation every platform can be optimised. The huge advantage of this approach is, that not a generic — for all platforms valid — GUI has to be developed. But keep an important detail in mind: The UI respectively its Logic has to be implemented in C#.
As promising this approach sounds it also has its disadvantages. For example it’s to too easy for the iOS and Android developer to implement the UI anymore. Instead the developer of the target platform has to know or to learn C# as well as the handling of the IDE Visual Studio or Xamarin Studio.
A valid question is whether it is possible that a C# developer implements the whole UI. However the UI development is challenging for a .NET developer because he/she needs to know the platform specific SDKs, the components, the usage and the architectural concepts. To speak from my own experience that is only possible to learn through direct native development on the particular platform.
Basically the following points are needed for cross platform development with Xamarin:
- .Net Developer without specific mobile experience to implement business logic respectively a Shared Library
- Platform specific developer (iOS, Android, etc.) with C#/.Net know-how to implement UI and its logic
- Xamarin licenses for 1000 USD annually per developer and platform (xamarin.com)
Further mentionable Xamarin Features/Facts are:
- The adaption of new mobile OS releases in Xamarin should be done within a few days — According to Xamarin itself
- Own native binding projects enable the further usage of platform specific libraries
- Beside iOS, Android and Windows Phone apps it is also possible to create Windows 8 and Mac OS apps
IOS and Android specific tutorials simplify the change or (mostly) introduction in mobile development with Xamarin. Therefore the following resources are highly recommended to all interested persons with technical background:
- iOS, http://developer.xamarin.com/guides/ios/getting_started/
- Android, http://developer.xamarin.com/guides/android/getting_started/
In the third and last part of this blog series you will find an explicit summary of Xamarin as a cross platform solution inclusive learnings and valuable findings out of the project practice.
We are a young Swiss company specialized in custom Nearshore-Models in the field of web and mobile development. We support companies from startups to large enterprises with highly qualified software developers at fair prices.
English translation by Tobias Baube