The pros and cons of Xamarin mobile development

Source: Internet
Author: User
Tags comparable

when considering iOS or Android app development, most of us will first consider Objective-c vs Swift and Java. as a local technology stack, they are naturally the most commonly used mobile development tool when it comes to iOS and Android application development. However, there are more ways to build high-performance and user-friendly mobile applications. and Xamarin is one of them. In this article, we have conducted an in-depth review of Xamarin and compared it with local and cross-platform mobile development solutions on the market. If you are familiar with the basics, consider jumping to the section you are interested in.

What is Xamarin?

Advantages of using Xamarin

Disadvantages of using Xamarin

Xamarin Visual Studio IDE

Xamarin vs Native ios/android and hybrid development

A little advice

What is Xamarin?

It is not possible to ignore Xamarin when talking about key approaches to mobile application development . Xamarin is a tool for cross-platform mobile application development that allows engineers to share about 90% of the code on the main platform. as a relatively new tool, it is based on the Microsoft technology stack and already has more than 1.4 million developers in the community.

The platform consists of Mono developed, the latter being a based. NET Framework's open source development platform, led by Miguel de Icaza, was first launched in 2001. Xamarin Company was founded on May 16, 2011.

However, unlike its predecessor, Xamarin was created as a commercial project until the company was acquired by Microsoft in 2016. Xamarin becomes a popular cross-platform product for developing mobile applications within the Microsoft ecosystem. The takeover broke the financial barriers to using Xamarin. as Microsoft develops the Xamarin SDK open source, it becomes part of the Xamarin Visual Studio integrated Development Environment (we discuss the following The best IDE for Xamarin Development ). What are the main features of Xamarin?

C # language. Xamarin uses a single language, C #, to create applications for all mobile platforms. Unlike an interpretative solution, such as Appcelerator Titanium, Xamarin is natively compiled, making it the preferred option for building high-performance applications that have a native look and feel.

based on. NET Framework. C # is a mature language with strong security to prevent unexpected behavior in your code. because C # is one of the. NET Framework languages, it can be used with many useful. NET features, such as LAMBDA,LINQ and asynchronous Programming (ASYNK).

Technically, Xamarin uses C # and wraps the native libraries in the. NET layer for cross-platform application development. These applications are often compared to native applications of iOS and Android mobile development platforms in terms of performance and user experience. In addition, Xamarin can take advantage of all native and up-to-date API access to take advantage of the underlying platform features in Xamarin applications, such as iOS or Android Multi-window Arkit.

while code related to business logic, database access, and network traffic can be shared across all platforms, Xamarin allows you to create platform-specific UI code layers. as a result, Xamarin cross-platform applications appear to be 100% native on any device and provide a better user experience than common hybrid applications.

compilation . The platform has two main products: Xamarin.ios and xamarin.android. in the case of iOS, the source code is compiled directly into the local arm assembler Code (ahead-of-time compilation), while the Android Xamarin application is first compiled into an intermediate language and then-assembled into the native assembly code at run time (just-in- Time compilation). However, in both cases, the process is automated, and issues such as memory allocation, garbage collection, and platform interoperability can be handled by default.

xamarin.forms. Xamarin.Forms is a standalone product designed to create prototypes or simple mobile apps that share 100% of code across iOS and Android.

Xamarin.mac. In addition, engineers can use XAMARIN.MAC to build applications for Mac OS. These and some other products from the Xamarin stack will be discussed later.

Platform SDK. Xamarin provides access to platform-specific SDKs (iOS and Android SDK Cocoatouch) through simple C # syntax.

platform-specific code bindings. In most cases, engineers will be able to handle the development of a xamarin environment that preserves the native look and feel of their respective platforms. However, if you have to re-use certain modules or implement platform-specific features such as barcode scanning, PayPal or Google Analytics integration, Xamarin allows you to invoke existing platform code (such as Swift for IOS).

wearable devices are supported. Xamarin supports building apps for Apple and Android watch devices. Engineers can use Visual Studio for Mac and Windows to build an iOS Apple watch app. In addition, Xamarin fully supports Android Wear.

Xamarin Project structure. Most of the work related to Xamarin is expected to run through windows development computers that have Visual Studio and Xamarin installed. applications can be debugged directly from the desktop or from devices and emulators. If you plan to develop an iOS application on Windows, it is also possible for Visual Studio to connect to the iOS storyboard designer and the iOS emulator. There is also visual Studio for Mac, which allows you to run the emulator on your Mac or run it directly on the tethered iphone. debugging runs through Visual Studio.

Xamarin Project structure. Image source:Visual Studio Documentation

For a more in-depth understanding of Xamarin Engineering, consider examining these resources:

The main Xamarin Documentation Center

Xamarin.android Documentation

Xamarin.ios Documentation

Xamarin.Forms Documentation

Visual Studio for Xamarin

Xamarin Studio App Center

Xamarin Community Forum

as with any other technology, Xamarin has its own strengths and weaknesses, and has recently been the subject of heated discussions. to make informed decisions about Xamarin and native development, let's use Xamarin to measure the advantages and disadvantages of application development.

advantages of using Xamarin for development

Many companies use Xamarin for a good reason , including Trello,slack and GitHub.

⊙ Write a technology stack for all platforms

Xamarin uses C # to supplement the. NET Framework to create applications for any mobile platform. As a result, you can reuse up to 96% of the source code to accelerate the engineering cycle. Xamarin also doesn't need to switch between development environments: You can build all of the Xamarin apps in Visual Studio that completely replace Xamarin studio. Cross-platform development tools are available as built-in parts of the IDE at no additional cost.

⊙ performance close to native

Unlike traditional hybrid solutions based on web technology, Xamarin builds cross-platform applications that can still be categorized as local applications. Performance Metrics are comparable to the performance metrics of Android Java (as described here ) and objective-c or Swift , and can be used to native iOS application development . Moreover,Xamarin's performance has been continuously improved, fully in line with the local development standards.   Visual Studio provides a complete solution for building, testing, and tracking the performance of your application:Visual Studio app Center Allows you to run automated UI tests and identify performance issues before publishing. However, this service is subject to additional charges.

⊙ Local User Experience

Xamarin allows you to create the perfect experience with platform-specific UI elements. Simple cross-platform applications for ios,android or windows are built using the Xamarin.Forms tool, which transforms the application UI components into platform-specific interface elements while the application is running. as the use of xamarin.forms significantly increases the speed of application development, it is a good choice for business-oriented projects. However, performance may be slightly degraded due to the additional abstraction layer. for custom application user interfaces and higher performance, you can still use Xamarin.ios and xamarin.android alone to ensure excellent results.

⊙ full hardware support

with Xamarin, your solution can get native-level application functionality. It eliminates all hardware compatibility issues, uses plug-ins, and specific APIs to use common device functionality on the platform. with access to platform-specific Api,xamarin support links to local libraries. This provides better customization and native-level functionality with minimal overhead.

⊙ Open source technology and strong enterprise support

after the company was acquired by Microsoft in February 2016, the Xamarin licensing policy changed radically. the Xamarin SDK, including runtime, libraries and command-line tools, has become open source and can be used under the MIT license as part of Visual Studio. by removing the major hurdles and costs of licensing, Microsoft paved the way for further development of the platform. In addition, led by Microsoft, and by Unity,jetbrains and Red Hat,. NET Foundation and Xamarin support, especially has become a reliable and powerful technology stack.

⊙ simplifies maintenance

With its cross-platform application, Xamarin makes maintenance and updates easier. You can easily deploy changes or updates to source files and apply them to iOS and Android apps. However, this applies only to the business logic that uses xamarin.forms or Xamarin.ios and xamarin.android applications, and to the shared code that updates the application. as a result, it can help you save time and money while keeping your application up to date.

⊙ Complete Development Ecosystem

Xamarin contains a complete development kit, including its own IDE (now being replaced by Visual Studio Xamarin Studio), the platform itself (Xamarin SDK), test (Xamarin test Cloud), Distribution and Analysis (Hockeyapp and Xamarin). Insights) platform. Therefore, you do not need to invest in other tools or integrate third-party applications to build, test, and deploy your Xamarin application.

⊕xamarin.forms: A framework for simple applications and prototypes

Xamarin recommends that developers build mobile applications in two ways. The first is the use of Xamarin.ios and xamarin.android, which is considered the main method. using the Xamarin.forms,visual Studio Library is the second one. Xamarin.Forms allows you to quickly build prototypes or build applications with fewer platform-specific features. That's why Xamarin.Forms is the best choice for applications where code sharing is more important than customizing the UI. you will be able to create a single interface and share it across platforms, without having to design separately for each platform. You can also build your application, where some of the user interface is built using Xamarin.Forms, while others are designed using a native UI toolkit.

Although Xamarin.Forms still has a trade-off in the local look and feel compared to Xamarin.ios and xamarin.android, there is a vibrant community that focuses on this tool. For example, some technology providers provide a rich engineering capability for libraries such as their Telerik UI , which provides pre-configured UI components.

⊕xamarin.forms Live player

because Xamarin.Forms is designed for rapid and frictionless development, Microsoft recommends using Live Player Tool . This is an application installed on the actual phone that can test and debug your application immediately, without the need for an emulator deployment or binding the device to a workstation. After installing live player, the developer uses the phone camera to scan the QR code in Visual Studio to access the currently developed application. the app on the phone synchronizes with the application in Visual Studio in real time. This greatly simplifies all setup and further debugging procedures. Unfortunately, Microsoft has stopped support for live player, but you can still download the app and pair it with Visual Studio.

⊙ building a Mac application using the Xamarin.mac tool

Xamarin.mac allows the development of fully native MAC applications using C # and. Net. it integrates with Xcode to develop the same library in Objective-c. by using Xamarin.mac with Xamarin.ios and xamarin.android, developers can share up to 90% of native code on Android,ios and Mac OS. In addition, Xamarin.mac integrates with Xcode, so developers can use Xcode's interface Builder to create an application's user interface.

⊕xamarin University offers a smooth entry-level training

Xamarin University is a dedicated e-learning portal for people who are just familiar with the software package. the University caters to engineers who know C # and anyone with a bit of programming experience. If you just bring the new engineer to your Xamarin-based product, the university will provide all the basics. the portal offers courses from beginner to advanced, including free self-study, online online courses, office lectures and guest lectures.

Xamarin Disadvantage Considerations

However, there are still some flaws that can cast shadows on the platform. So, why not use Xamarin?

θ slightly delayed support for the latest platform updates

It all depends on the Xamarin development team. third-party tools are unlikely to provide immediate support for the latest iOS and Android versions: It takes some time to implement these changes and/or introduce new plugins. Although Xamarin claims to provide support for the day , it may still be delayed.

θ access to open source libraries is limited

Open source technology is widely used in local development. with Xamarin, you can only use The platform- provided components and some. NET open source resources for developers and consumers . Although the selection is not as rich as Android and iOS mobile app development , the Xamarin component provides thousands of custom UI controls, a variety of charts, graphs, Themes and other powerful features that can only be added to the app are few clicks. This includes built-in payment processing (such as stripe), beacons and wearables integration, out-of-the-box push Notification Services, cloud storage solutions, multimedia streaming capabilities, and more.

Θxamarin Ecological System problems

Obviously, the Xamarin community is much smaller than iOS or Android. Therefore, finding an experienced Xamarin developer can be a challenge. Although the platform is growing with the support of Microsoft. based on information from different sources, the Xamarin community accounts for 10% of the global mobile development community. Although the number of Xamarin engineers is not comparable to the iOS or Android local community, the platform provides a wide range of support for its developers. in other words, there is a dedicated educational platform, Xamarin University, which provides resources and hands-on training for those unfamiliar with the technology. using this support, the experienced c#/. The learning curve for net engineers is minimal.

θ requires a basic knowledge of the local language

When you use Xamarin.ios and xamarin.android to build mobile applications that have a real native look and feel, you still need to write a platform-specific layer of code. Therefore, you need at least a basic knowledge of native technology (Android Java/kotlin and iOS objective-c/Swift). However, this does not apply to xamarin.forms.

θ does not work with re-graphics applications

The main advantage of Xamarin is the ability to share your code across platforms. However, you can only share logic, and the UI code will be primarily platform-specific. This makes it meaningless to build games in Xamarin, rich custom user interfaces, or complex animations. with a small amount of shared code, Xamarin becomes an option that is not feasible.

theta Larger application size

depending on their type and complexity, xamarin applications are typically larger than on-premises applications (which may be half the size of a Xamarin application). a simple "Hello,world" Application for Android may require up to a maximum of MB, most of which apply to the associated library, content, mono runtime, and base Class Library (BCL) assemblies.

Source- developer.xamarin.com

Therefore, the Xamarin application typically requires additional optimizations to keep the application file size reasonable.

θ compatibility issues with third-party libraries and tools

You may encounter some problems when you integrate third-party resources with your Xamarin application. While most tools and libraries provide full support for local technology, Xamarin compliance may not be provided by Vedor. Although Xamarin has its own component store, you may need specific functionality or consolidation in your application that does not provide these features or integrations.

Xamarin Visual Studio IDE

If you have a feeling that Xamarin is right for you, you will be interested in knowing the main Xamarin ides you can use and how they compare to each other.

Visual Studio (VS) is the Microsoft Integrated development environment for building, debugging, and publishing applications on all platforms and devices. Xamarin has three major versions of Visual Studio-the Visual Studio community, Visual Studio Professional, and Visual Studio Enterprise. The key factor in choosing an acceptable version is the experience of the developer (student or Professional engineer) and its team size. programmers can develop software for all versions of Web, mobile, server and desktop.

Visual Studio Community Ideal for students, open source projects and small development teams of up to 5 users. Community packages are also available to the Novice team in Visual Studio. This version is free to use.

Visual Studio Professional is a set of tools and services that are created for professional developers, small teams, and enterprise use. This release provides powerful features to quickly understand your code: Show code references, change the code, show who last modified the method, or discover whether the test is being passed. The Professional Edition includes team Foundation Server 2017, which provides features such as Agile project planning tools, delivery plans, charts, and more. The annual fee for this version is $539 per user.

Visual Studio Enterprise powerful Support tools and services. They allow for the management of complex processes between development and IT operations; track quality using manual and automatic tracking tools; access to professional training; and the entire Microsoft engineering and testing ecosystem. It includes Microsoft extensions for Visual Studio Team Foundation Server and Visual Studio Team Services. in this release, Team Foundation server provides you with Test Manager, package management, and dedicated pipelines. The Enterprise Edition also has priority support, partner offers, and more. Enterprise Studio has a yearly price of $2,999 per user.

for business purposes, we also recommend checking Visual Studio Application Center . It is a tool for organizing application development workflows, covering different mobile technologies such as Xamarin. Here, engineering teams working in multiple applications can assemble their tools together. It is packaged with GitHub or BitBucket automation applications, provides integration for different test services, supports e-mail application distribution for testing, and ensures crash tracking and analysis.

Visual Studio Online (VSO) is a set of tools that allows developers to easily set up continuous integration across different platforms. Continuous Integration is a software practice where all code changes are tested immediately and integrated with the master code base. It helps you quickly check and debug your code. This version is probably the most relevant and interesting version of the mobile developer.

switch from Android Studio or Xcode to Visual Studio

If your development team is considering transitioning from Android Studio (as) or Xcode to Visual Studio, the learning curve will not be that steep. The comparison of functional characteristics shows that the IDE is very similar in terms of the development process, with subtle differences in each environment.

from Android Studio to Visual Studio. While official support for Android Studio focuses on java,c/c ++,kotlin and XML languages, VS supports all major programming languages including as . This is because the IDE caters to a wide variety of platforms. vs offers more freedom of engineering and allows different projects to be handled in one environment. If you've been running virtual machines or just managing projects with Google Cloud Platform integrated with AS, Google is also good at providing its Cloud Platform Extensions for VS . Basically, you can use the Microsoft Cloud ecosystem and Google Cloud directly from vs. Visual Studio can be installed on all major platforms: Windows,android,mac OS and Linux.

from Xcode to Visual Studio. the Xcode IDE, like VS, supports source code for all major programming languages. So there will be no surprises after the transition. Similarly, if you are binding with Mac OS while using Xcode, then the VS does not require Apple hardware. for those who use Cloudkit for server-side storage, Visual studio and Xamarin allow simple integration with Cloudkit. the main disadvantage of using VS with Xcode is the same: both Android studio and Xcode are free to use, and VS requires a fairly high subscription fee.

based on developer estimates , both Visual Studio and Android studio have roughly the same ease-of-use level and support quality. Comparing the same index to VS and Xcode, we can say that the VS estimate will be better. in addition, Visual Studio is more popular in the Enterprise (> 1000 employees), while approximately 50% of Android studio and Xcode users are small businesses (fewer than 50 employees).

considering the Strategy Analytics ranks in the Mobile development environment, with Xcode and Visual Studio ranking the highest in terms of testing capabilities. Android Studio lags behind. The total score is: Xcode-22; Visual Studio-21; and Android Studio-13.

Consider other options: Xamarin vs Native ios/android and hybrid development

recently, many developers tend to think that xamarin can be considered a "local" development tool. In fact, there is a view that " any thing that can be done using objective-c or Swift's iOS app, And anything that can be done with Android apps that use Java can be done in C # using Xamarin . "

However, there are many drawbacks to the Xamarin debate at home. Let's look at how Xamarin compares to local development tools and the hybrid development platform (Ionic,phonegap/cordova).

Although hybrid mobile development tools are rapidly evolving, they still lack the performance and local functionality that Xamarin provides, at roughly the same cost. When considering both approaches, the most common dilemma is Xamarin vs Ionic or Xamarin vs React Native (see also our about Reactjs and React A comprehensive explanation of the pros and cons of native ). However, the latter tends to fail due to many limitations in the underlying technology (web stack) .

However, JavaScript-based mobile development tools are better at least in terms of UI than hybrid solutions. it is nativescript. This Cross-platform open source framework, supported by Telerik, allows you to implement a local UI and connect to native APIs for a better mobile experience while using a single code base. The main difference is that it uses XML tags, which are compiled into Android and iOS native equivalents rather than HTML webview.

This approach fills the gap between native and hybrid development, similar to the way Xamarin does. the main difference between the two tools is the programming language they use. Therefore, the comparison between Xamarin and Nativescript should be the subject of a more detailed study.

At the same time, the development debate between Xamarin and the native Android/ios seems more complex: both options prove to provide value in terms of product quality and performance, but the choice usually depends on the type of application you want to build.

a little bit of advice

when comparing pros and cons, the listed drawbacks are usually considered collateral damage. Most business owners choose the Xamarin mobile app development platform because it reduces time-to-market and engineering costs by sharing code and using a single technology stack. However, the purpose of the application and its target audience may be a more important consideration.

based on our team's experience, the best use case for Xamarin is Enterprise Mobility Solutions . with a standard UI covering 90% of projects, all core product logic can be easily shared across platforms. Therefore, the platform customization requires only 5-10% of the project volume.

If a consumer-facing application has a large number of user interfaces, the number of shared code will drop sharply. As a result, Xamarin's cross-platform development loses its primary advantage and can be comparable in time and cost to local solutions.

However, if you are looking for a xamarin alternative to build cross-platform mobile apps, you may be disappointed. While the most widely used cross-platform mobile development tools are Phonegap/apache cordova,ionic framework,appcelerator/titanium, they rely primarily on web technology, such as HTM5 or JavaScript. That's why none of these tools meets the same level of performance and native functionality that Xamarin provides.

This article is part of our "Good and Bad" series. If you are interested in website development, please check out our blog post

The pros and cons of Xamarin mobile development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.