Xamarin: The Good, the Bad, and the Ugly
Xamarin: The Good, the Bad, and the Ugly
In the face of a rising demand for cross-platform mobile apps, Xamarin provides efficient tools for cross-platform development and collaboration.
Join the DZone community and get the full member experience.Join For Free
Mobile applications are on the rise! Hence, developers prefer building native mobile applications that offer the fastest, most reliable, and most responsive experience to users. Businesses now want to have a mobile app run across major platforms such as Android, iOS, and Windows devices. Therefore, we can see that there is a steep rise in cross-platform mobile apps.
Statistics released by Dot Com Infoway showed that about 83% of developers utilize cross-platform tools, mainly for initiatives like development, analytics, crash reporting, and testing.
Challenges for developing cross-platform apps
Owing to Xamarin's multi-platform functionality, reduced development time, and application performance, it has become the “The Choice" for the developers building cross-platform mobile applications. We can say without a doubt that cross-platform will become more robust in the near future.
We have been in development of cross-platform apps for four years and have been working on multiple platforms such as PhoneGap, Xamarin, Sencha Touch, Monocross, and Appcelerator for building Android, iOS, and Windows apps. In this article, we are sharing a few insights about why Xamarin has become the most preferred choice for mobile app developers.
Xamarin: The Good
Xamarin architecture consists of a visual design platform to develop native-like applications, testing suites, native library support, and a nugget-style component store. Recently, iOS visual design has also been provided through their IDE to help developers from requiring opening X-Code. LINQ can be used with collections, as well as to create custom delegates and events that free developers from Objective-C and Java limitations.
Xamarin aims to be the framework that can cover all major mobile platforms- iOS, Android, and Windows- without compromising on quality and performance, as expected from native apps development. Well-known mature .NET framework libraries are available on Android and iOS platforms as well. The rich features of these libraries give an added advantage to Xamarin considering the developer viewpoint.
Simplified and Faster Development
Xamarin simplifies code sharing across platforms. It provides the benefits of native UI to help retain the features of native application development. Having C# as the development language enables the developer to use the rich features.
Share Code Everywhere
One of the greatest benefits of using Xamarin is that it allows the creation of Android, iOS, and Windows phone applications sharing the same C# code base. Code reusability can be improved to about 80%. Now with Xamarin Forms, we can achieve 96% reusability on a project.
Portable Class Libraries
Through Portable Class Libraries (PCLs), developers can write the code in libraries which can be further shared across Xamarin, iOS, Xamarin Android, and Windows Phone. Popular PCLs like SQLite, Json.NET, or Reactive UI can be used on every platform. You can build your own app logic as a PCL and use it everywhere.
Xamarin Component Store allows the addition of high-quality components to your app directly from your IDE, including UI controls, charts, graphs, web service, beautiful themes, cloud services, APIs, and more. It is integrated with Xamarin Studio and Visual Studio so that the components can be easily added to your apps.
With Xamarin Forms, interface design for all three platforms can be accomplished within a XAML-based framework. Xamarin Forms includes more than forty controls and layouts, which are mapped to native controls on runtime.
Here is a comparison table that shows differences between the three platforms:
Xamarin License Cost
The cost of a Xamarin license is expensive to support large projects.
Incompatibility With Latest Version of Various Platforms
Like other cross-platforms, Xamarin is built on the native iOS OS and framework. There is delayed support for the latest platform updates for iOS, Android, and Windows. In spite of having a large team, Xamarin takes time to accommodate the OS changes for iOS and Android.
Limited Access to Open Source Libraries
Xamarin cannot use open source libraries that are popular on iOS/Android, although .NET has its share of open source support.
One of the major drawbacks is that some of the components have inadequate documentation. For example, it is difficult to understand how Java documentation is to be done on Xamarin.
Xamarin Community Support
There is very limited community support available for Xamarin. Forums and help support are not readily available for Xamarin users on the net.
Visual Studio Designer
The Visual Studio UI editor is not suitable for designing list views, working with fragments, or making something that will scale easily.
Exploring the Role of Xamarin in Our Recent Project: Asset Management Application
Manually tracking the asset information was a time-consuming and tedious task for the client, as the information needed to be tracked and noted each time for each asset. Therefore the client needed a system that would improve asset management by providing an automated, systematic, and accurate asset management application.
We proposed a solution: to create an asset management application with an integrated RFID-based Zebra 8500 reader that could scan the RFID tags. Each asset would be marked with an RFID tag and, using the Zebra 8500 reader, the information about the asset would be retrieved and written on the RFID tag.
We developed an automated asset management application using RFID technology. To integrate the reader with the application, we used a native SDK provided by the manufacturer. The application was built using Xamarin forms and the reader SDK was in Objective-C. To communicate to Objective-C from C# code, we used the Sharpie tool which created intermediate definitions for Obj-C code and provided the bridge we required.
Xamarin Forms was used to achieve code reusability. We have effectively achieved almost 85% code reusability. In spite of limited control support in Xamarin Forms, we could modify the controls using custom renderers. The entire business logic was written in PCL, which provided a decent level of abstraction to UI.
Xamarin has emerged as one of the most powerful tools for cross-platform development, hence it is able to reach billions of smart devices irrespective of the platform. We recommend Xamarin as it ensures the flawless building of cross-platform applications, as it utilizes the power of C# and provides wrapping of all native and iOS libraries. With no doubt, we can say that Xamarin has become the “The Choice” for the business due to its seamless API integration capability, easy collaboration and sharing, rapid development, and cost efficiency capabilities.
Published at DZone with permission of Parth Jani . See the original article here.
Opinions expressed by DZone contributors are their own.