Key Takeaways
- Cross-platform development reduces the development and maintenance effort for mobile apps.
- Microsoft's acquisition of Xamarin benefits companies who operate mainly as a Microsoft "shop".
- Xamarin is gaining popularity since its inclusion in Visual Studio, especially because it is now open-source and free.
- Xamarin is "near-native"; source code is compiled into native iOS and Android.
- Xamarin.Forms, Test Cloud and University make Xamarin even more attractive as a development platform.
Xamarin, once a niche and pricey product, is steadily becoming a popular tool for mobile app development (slides 4 and 6). There are a number of very good reasons for this as well as a few drawbacks that make it unsuitable for certain kinds of apps, as this article will detail. Xamarin is a cross-platform development tool, so we will also weigh up the pros and cons of cross-platform versus native development. But first, a brief history of Xamarin and from whence it came.
Gnome, Mono and Ximian
Miguel de Icaza, initiator of the Gnome Project and open-source champion, recognized that in order for open-source to gain acceptance, it had to look and feel like the commercial software available from companies such as Microsoft and Novell. It was for this reason that in 1999 that de Icaza started to work with Nat Friedman. They had met briefly when De Icaza went for an unsuccessful interview at Microsoft in 1997, where he told the executives that their software should be open-source. The interview did not go down well, but Nat and Miguel started Ximian, whose main project was Mono. Ximian was acquired by Novell in 2003, in an attempt to win back their dwindling network market share from Microsoft. Novell was subsequently acquired by Attachmate in 2011, who laid off most of the Mono resources.
This was seen as an opportunity by de Icaza and Friedman, so they founded another startup, Xamarin, to develop products for mobile application development. Their first product, Xamarin.Mac, released in 2012, allowed developers to write apps in C# for the Apple Mac, which could later be sold via the Apple Store. In 2013, they announced Xamarin 2.0, an IDE that gave developers the opportunity to develop apps for iOS, Android, and Windows using Microsoft Visual Studio. One of its main drawbacks was that the Xamarin license was very pricey.
Microsoft had been watching de Icaza through the years, and Xamarin was the product they really needed, because of its ability to develop apps for Android and iOS via Visual Studio. They acquired Xamarin, and did what De Icaza asked them many years before – they bundled Xamarin into .NET as an open-source IDE.
Source: Presentation by Craig Dunn
The Case for Cross-Platform Development
When it comes to mobile app development, there are three main options: native, cross-platform, or hybrid apps. We are excluding hybrid solutions here, because they generally do not meet the quality and robustness of native or true cross-platform development.
Three Platform development options - Image source
Native development is about using a programming language and APIs that are specific to the device platform, like Objective C or Swift for iOS. While this makes it possible for developers to produce a best-fit product for the device, there are some serious drawbacks including:
- The need for developers who are familiar with the platform language and APIs.
- Increased time to market.
- Increased maintenance costs.
Your Development Team
To develop a native app, you will probably need at least two teams: one for iOS with Swift/Objective C skills, another for Android with Java skills, and possibly a third team for Windows. You will also need to ensure that your teams keep their skills up-to-date and that they are not poached by other companies, for these skills are in high demand. Using a cross-platform approach does not eliminate this issue, but it it by limiting the skill-sets you need on board.
Having multiple teams that are essentially performing the same work, when developing the code and when testing it, has the end effect of multiplying your development costs.
Increased Time to Market
When you have different teams dedicated to developing an app, the time to market can be longer, because you have two (or more) different teams writing, testing, and debugging the same application for the different platforms using different languages, instead of using a common stack based on C#. Using a cross-platform approach should help reduce the time it takes to launch your app.
Maintenance Costs and Complexity
Consumer electronics companies love releasing new phones and enhancements to their operating systems in order to keep their customers engaged. Additionally, your app will need its own upgrades and updates. This keeps application development teams busy testing the app on the new devices and issuing new releases and fixes. With a cross-platform option, you can test most or all of the devices and changes on a single code base. If you have developed separate native apps, your maintenance effort and release scheduling is more complex. As with the initial development, if you build a native app, your time and overhead to stay current will increase, and you will need a bigger development team.
How Cross-Platform Development in Xamarin Compares
A cross-platform approach has many benefits, the main one being reduction of complexity, which brings with it reduced costs and effort. While any cross-platform solution should enable you to eliminate duplication of effort and better maintainability, Xamarin has other benefits to bring to the table.
Here are some of them:
- Enhanced ability to reuse
- Testing considerably reduced
- Maintenance streamlined
- Comprehensive Xamarin environment
- Real-life testing on 2,000 devices in Xamarin Test Cloud
- Near-native performance
- Geolocation and beacon usage supported
Functionality Developed Only Once
Over 70% of code can be reused in Xamarin. This implies that many features developed for Android can be leveraged for iOS too, without having to rewrite everything. So, when your developer has completed the coding and testing phases for one environment, be it Android, iOS or Windows, he can use the same coding for the other environments with minimal impact. This allows to get to the market faster than using native approaches.
Reduced Testing Time and Effort
We are not meaning to skimp on testing. Software testing is a critical component of any application, regardless of the device on which it should run or the approach to development you take. But, the fact that much of the functionality can be tested and debugged for one operating system (e.g. Android) cuts down time when testing on the other (e.g., iOS), as part of the functionality has been already validated on one platform and testing can just focus on what is specific for the other platform. Compare this with two teams working in tandem on two different systems.
The Xamarin Environment
Xamarin provides a comprehensive IDE within which the developer can execute every task needed to build a a final product. Xamarin recently introduced Xamarin.Forms, which makes development even easier, although one needs to be experienced in Xamarin to decide whether to use Forms or stick to traditional Xamarin development. Xamarin themselves recommend starting with Xamarin.Forms.
Source: Presentation by Craig Dunn
There is also the Xamarin University to help developers get up to speed in all the areas required.
Access to Xamarin Test Cloud
Test Cloud is an environment that allows you to simulate real-world conditions with over 2,000 real phones to test your app on. It is not free, but it is definitely worth it to test at least some of the models favored by your target audience. Furthermore, organizations that have bought the Visual Studio Enterprise license get a 25% discount on the Test Cloud pricing.
Near-native performance
Some of the cross-platform and hybrid competitors to Xamarin cannot match Xamarin's performance in the field. This is because Xamarin compiles the source code into a binary object, while many of its competitors, such as Sencha and PhoneGap only compile at runtime. Hacker Harry Cheung performed some comparative tests in 2015 for Android and Apple, admittedly with devices that are now out-of-date, which showed impressive results for Xamarin, particularly on iOS.
Using Beacons and Geolocation
For those who want to use beacons and geolocation in their apps, Xamarin supports location technologies and the Internet of Things(IoT) via proximity devices, which include beacons and geolocation. Xamarin has a good working relationship with Estimote, who manufactures such devices and offers a Xamarin SDK for such development. One does not have to use it, but the Estimote kit makes life easier when developing an app that will receive in-store messages via iBeacons (or other protocols), as it includes reporting and monitoring on the IOT devices.
Xamarin is Cross-Platform but Near-Native
Having discussed the merits of cross-platform development, we would like to highlight a bonus when using Xamarin. It is that Xamarin is "near-native" for both iOS and Android. One of the ways this is achieved is that all the APIs available to developers using Objective C or Swift for iOS and Java for Android can be called directly from C#. The standard user interface controls available to native developers are also accessed by Xamarin, producing the correct look and feel once the app is run on the device.
There is very little that you cannot achieve with C#, but there might be a requirement for a small amount of native code. This is where an experienced Xamarin developer could be a boon in developing an app, because they can make the judgement call based on their past experience.
Where Xamarin Works Well
Xamarin is excellent for corporate applications and anything that requires extensive backend development, because it has a robust backend architecture. Although it is somewhat restricted where a feature-rich UI is required, Xamarin can still produce very compelling and useful applications as seen in the case studies mentioned later in this article.
The biggest benefits are the time to develop and the efficiency of working cross-platform. Most mobile app projects have punishing deadlines, because of the threat of competition, and the speed of development afforded to Xamarin developers is not to be ignored. An added bonus is the ability to integrate IoT devices like beacons and smart glasses using the Estimote SDK.
The fact that Xamarin operates within the Microsoft ecosystem is also a big plus for corporations, most of whom will have already invested in products such as Visual Studio and probably have a stable team of .NET developers.
Where Xamarin Has Weaknesses
It's not all good news. Xamarin may not be the best option in the following cases:
- Complex user interface (B2C cases).
- Animations and extensive graphics (e.g. games).
- When some native coding is still required.
- When your app is going to be large.
- When you need to use specific open-source libraries.
- If you can’t afford the Xamarin license.
Complex UI Interface
When your application is targeted at end-users and needs to be feature-rich on the frontend, it is advisable to go native. Xamarin.Forms is quite adequate for straightforward user interfaces, and you benefit from Xamarin's excellent functionality on the backend, but cannot compete with native SDKs when you need a complex UI. This is because the UIs for iOS and Android have to be designed and implemented separately to respect the platform look and feel, so you will end up with less than half of the application code being shared, instead of the norm of 75% or close to 100% when using Forms. This defeats the whole point of using Xamarin, . Instead, use Objective C or Java.
Graphics and Animation
If you are thinking about game development, Xamarin is not a good bet either. Applications that require strong graphics or animations are not suited for Xamarin. This does not completely rule out Xamarin for game development, though, as Bastion demonstrated with their game for iPad. Recent developments by Xamarin may change this scenario, furthermore.
Not a 100% Solution
As we mentioned earlier, there may be cases when you need to write a small amount of native code to build your full solution means your developers still need to have native skills, thus reducing the benefits brought by Xamarin.
Limitations in Accessing Open-source Libraries
Native developers can use all the open-source libraries available for the platform they target. Xamarin developers are instead constrained to what is available to them in the Xamarin environment, which is usually less. With the growing popularity of Xamarin, though, it is expected that this will become less and less of an issue in the future, as the recent development of the NuGet gallery shows.
Xamarin Apps are Larger
Xamarin apps are larger, and some extra work may be required to optimize their size. If an app is too large, it will take too long to install and could cause storage and access problems on the customer's phone, which will make them delete the app.
Xamarin May Be Free, but Visual Studio Isn’t
As Xamarin is bundled into Visual Studio, you might find that you need Visual Studio Professional or Enterprise to get the functionality you require. The entry level products are free, but they do not have all the features, of course.
These are not cheap products. There are standard and cloud licenses. Here is the pricing for standard licenses to give you an idea of the costs.
Successful Adopters of Xamarin
We have selected a few cases where Xamarin has been used by companies in different industries to their satisfaction.
Siemens PLM
Siemens PLM have a huge portfolio of expensive engineering software, with over 9 million seats and 77,000 users worldwide. Siemens wanted to extend their market with a light and mobile drawing/CAD app called Catchbook, where users can draw shapes with their fingers or a stylus. Siemens chose Xamarin because they had Microsoft skills, but no iOS or Android skills. The first benefit was that they could port a lot of their existing code. Secondly, they could get 75% of the application up and running without the hassle of learning the native iOS and Android languages.
The World Bank
The World Bank had a small base of 8 developers who knew Visual Studio and C#, so they were able to get productive very quickly. They developed a very complex survey system rapidly for Android devices only, as these were the phones of choice in the developing countries they were targeting.
Coca-Cola Bottling Co. Consolidated
The world's largest Coke bottling company got its "MarketPlace" application up and running in just 4 months. Again, they had a workforce with .Net and C# skills, as well as familiarity with Visual Studio, which is why Xamarin got them interested. They brought in 2 seasoned Xamarin developers to mentor the teams. (By the way, one of the products they used for team collaboration was Slack, which also uses Xamarin).
What the Community Has to Say
Xamarin is very popular among development companies who are contracted to develop mobile apps because of the agility it offers them to get products up and running in the shortest time. Here are a few selected comments from the Clutch Review forum.
"For developers experienced in .NET and C#, who are looking to integrate a Microsoft stack back-end, Xamarin is an excellent tool to leverage."
"We have shipped numerous mobile apps by working with Xamarin successfully, and these are always very much appreciated by our clients. For example, one client needed an app to be delivered in almost half the normal time because it was to be demonstrated at a huge event. Because Xamarin allows us to share code seamlessly, we were able to meet the deadline, and the client was very happy. There is always an advantage to using Xamarin when we are faced with that kind of time pressure".
"As mentioned, the biggest con is that the tool faces problems when it comes to graphics or apps that require a high-level of automation".
In Conclusion
While Xamarin is not suitable for all mobile apps, it ticks the boxes for most applications in the corporate environment. These applications can be quite complex as seen in the case studies above. In corporate environments, the use of C# as the go-to language for Xamarin has given it an edge over many of its competitors. The market for Xamarin has also been growing rapidly since the Microsoft acquisition, which can only mean good news for existing customers.
About the Author
Adriana Blum is a senior technology architect at the mobile app development company Iflexion, has over 13 years of experience in managing and delivering custom mobile solutions. She helps organizations automate processes, find new opportunities and create applications that bring high value to businesses.