Use Xamarin for cross-platform mobile app development (reprint)

Source: Internet
Author: User

Just saw Zhang Shanyu in the circle of friends, forwarded a share "using Xamarin to achieve cross-platform mobile application Development", written in a very detailed and appropriate, from the charge to open source, this time Xamarin has been a lot of questions, so Wen http://blog.csdn.net/ aofengdaxia/article/details/41891945/. Of course, this essay is also reproduced (if you do not write an essay, you may not see this article). I hope that developers who have been in the pit of Xamarin can have a new understanding

Original link: Http://www.infoq.com/cn/articles/mobile-cross-platform-xamarin

Original Adriana Blum

This article highlights
  • For mobile applications, the cross-platform development approach reduces the cost of development and maintenance.
  • Microsoft's acquisition of Xamarin has benefited companies focused on Microsoft technologies.
  • Since Xamarin was added to Visual Studio, it has become increasingly widely used. Of course, this is also due to its current open source and free.
  • Xamarin is "almost native". It compiles the source code into native iOS and Android.
  • Xamarin.Forms, Test Cloud, and Xamarin University make the Xamarin platform more appealing to developers.

Author Adriana Blum , translator Guelle published on January 12, 2018. Estimated reading time: 22 minutes

Xamarin was once a kind of profit-based product that was expensive to sell. Now it is becoming a widely used mobile application development tool (see links to the 4th Zhang and 6th of the slide). For some reasons, Xamarin does not apply to certain types of applications, and there are many drawbacks to it itself. For this, this article will do a detailed introduction. At the same time, Xamarin is a cross-platform development tool. Therefore, we will also weigh some of the pros and cons of cross-platform and native development in this article. Let's start with a brief overview of Xamarin's rollout and development history.

From Gnome, mono to Ximian

Miguel de Icaza is the founder of the Gnome project, and he is also an open source project Champion (open source Champion). In his view, to allow open source projects to be recognized by the public, the project must be made with Microsoft, Novell and other companies to provide business software identical. With this in mind, de Icaza began working with Nat Friedman in 1999. They had a brief encounter in 1997, during an unsuccessful Microsoft interview at de Icaza. At the time, de Icaza pointed out to Microsoft management that their company's software should take the path of open source. The interview was not progressing well, but since then Friedman and de Icaza created the Ximian project, the most important of which is mono. Ximain was acquired by Novell in 2003, when Novell was trying to win back their shrinking network market share from Microsoft. Since then, Novell was acquired by Attachmate in 2011, while Attachmate cut off most of the mono project's resources.

Related Vendor Content

A lesson to teach you to understand technology innovation and business model Qcon Beijing 2018 a new development practice that the best programmers should know about the end of the last dry Sea summit

This is undoubtedly an opportunity for de Icaza and Friedman. As a result, they started another start-up project, Xamarin, for developing products for mobile applications. Their first product, Xamarin.mac, was released in 2012, enabling developers to use the C # language to write apps for Apple Mac and sell them through the Apple store. In 2013, they released Xamarin 2.0, the launch of this IDE product that enables developers to use Microsoft Visual Studio to develop apps for iOS, Android, and Windows. But one of the main drawbacks of this version is that Xamarin's licensing fees were very expensive at the time.

Over the years, Microsfot has been focusing on de Icaza's movements. At Microsoft, Xamarin is the product that the company really needs because Xamarin has the ability to develop Android and iOS apps using Visual Studio. This allows Microsoft to acquire Xamarin and bind Xamarin as an open source IDE to. Net. That's what de Icaza wanted Microsfot to do years ago.

Figure 1 The development history of Xamarin (Photo source: Craig Dunn's slideshow)

Cross-platform development cases

There are three main ways to develop mobile applications: native, cross-platform, and hybrid. This article will not cover hybrid solutions, as this solution often fails to achieve the quality and robustness of native or True cross-platform development.

Figure 23 Development methods (Image source: Matt Larson at the Xamarin experience London 2017 Conference presentation slideshow)

Native development uses device platform-specific programming languages and APIs. For example, on iOS, you are using objective C or swift. Despite this approach, developers can roll out the products that are most suitable for devices, but there are some serious problems with them:

    • Developers are required to familiarize themselves with the platform language and APIs.
    • Increase the time to market;
    • Increased maintenance costs.
Issues in the development team

For developing native applications, you may need to maintain at least two teams. One team has swift/objective C development skills on the iOS platform, and the other team has the Java skills to work on Android. It is even possible to maintain a third team, a team with Windows platform development skills. We also need to ensure that the team is kept up-to-date with skills, and that people are not being dug out by other companies because of the current high demand for these skills. If you use a cross-platform approach, this problem will not be eliminated. However, this approach reduces the skills required for a developer to get into the job, and the problem is mitigated to some extent.

When developing code and testing code, if you need to maintain multiple teams that are basically doing the same work, this will ultimately have an impact on development costs.

Increased time to market

When there are several different teams in the company that are involved in application development at the same time, it may take longer to go public because there will be two (or more) teams writing, testing, and debugging the same application on different platforms in different languages, rather than based on a common C # technology stack. If you use a cross-platform approach, this will help reduce the time it takes to roll out your app.

Increased maintenance costs and complexity

Consumer electronics companies, in the interests of maintaining their own customer base, like to constantly launch new mobile phones, and continue to innovate the operating system. Accordingly, applications need to be constantly upgraded and updated. This allows the application development team to be busy testing applications, releasing new versions and patches on new devices. If you use a cross-platform approach, we can test most or all of the devices and changes on a single codebase. If we choose a standalone native application, maintenance work and release schedules are more complex. At the start of development, if we created a native app, then the time and the overhead would keep growing. The company will need to maintain a larger-scale development team.

Figure 3 Platform-specific development approach (Photo source: Matt Larson at the Xamarin experience London 2017 Conference presentation slideshow)

The benefits of Xamarin cross-platform development

The cross-platform approach to development has many advantages, primarily reducing complexity, which reduces costs and effort. While any cross-platform solution can help eliminate duplication and provide better maintainability, Xamarin offers other advantages. Some of these benefits are listed below:

    • Improve the reusability of the Code;
    • To a large extent, the test work is reduced;
    • streamlined maintenance;
    • Provide a comprehensive xamarin environment;
    • Field-tested on more than 2000 devices available on Xamarin test cloud;
    • Near-native performance;
    • Support geolocation and use ibeacon.
One-time development of functions

In Xamarin, more than 70% of the code is reusable. This means that many of the features that are developed for Android can be used for iOS without rewriting everything. As a result, once developers have completed the coding and testing phase for an environment, whether Android, iOS, or windows, they can use the same code for other environments and minimize the impact. Applications can deliver the market faster than using native development methods.

Reduced test time and effort

We are not talking about cutting testing. Regardless of the type of device that should be run, software testing is an important component in any application development, regardless of the type of development you choose. However, after testing and debugging most of the functionality on one operating system (for example, Android), the test time on another operating system (such as iOS) is scaled down because some of the functionality has been verified and tested on one platform. In this way, developers can focus on some platform-specific issues. This approach reduces test time and effort by allowing two teams to work in tandem on two different systems.

Xamarin Environment

Xamarin provides a comprehensive set of IDE features that developers can perform in the IDE for each task they need to build the final product. Xamarin recently launched the Xamarin.Forms, which further simplifies development. However, there is still a need for developers to have Xamarin experience to decide whether to use forms or to stick with traditional xamarin development. The official Xamarin recommendation starts with Xamarin.Forms.

Figure 4 The comparison between Xamarin and xamarin.forms (Photo source: Craig Dunn's slideshow)

Figure 5 Comparison of Xamarin.Forms and Xamarin native development (Image source: Xamarin official website)

Xamarin also provides online Xamarin University, which helps developers quickly familiarize themselves with the various areas of development that they need.

Visit the Xamarin Test Cloud

Test Cloud provides an application test environment that allows developers to simulate real-world situations and field-test more than 2000 real phones. Test cloud is not free, but for many target models that are favored by a broad range of target audiences, using Test cloud is undoubtedly worth the money. In addition, a 25% discount on test cloud is available for organizations that have purchased Visual Studio Enterprise licenses.

Near-native performance

In the field of cross-platform and hybrid development, no competitor's performance can rival Xamarin. The reason for this is that Xamarin compiles the source code into binary objects, and many competitors (such as Sencha and PhoneGap) compile only at run time. In 2015, a developer Harry Cheung Some contrast tests on Android and Apple. It must be admitted that testing the equipment used at the time is now completely obsolete. This is especially true for Xamarin, especially on iOS.

Figure 6 Application performance comparisons developed on the iOS platform (image source: Harry Cheung's Medium blog post)

Figure 7 Application performance comparisons developed on the Android platform (image source: Harry Cheung's Medium blog post)

Using ibeacons and geolocation

If users need to use beacons and geolocation in their apps, Xamarin can use proximity devices, including beacons and geolocation, to support targeting and the Internet of Things (IoT). There is a good relationship between Xamarin and Estimote. Estimote manufactures equipment and provides a xamarin SDK that can be used for development. Although users are not necessarily limited to estimote devices, estimote devices do make life easier, as device-based applications can receive onsite information through ibeacons (or other protocols), including reporting and monitoring of IoT devices.

Xamarin is a cross-platform, but almost native

While we've covered many of the benefits of cross-platform development, here's a highlight of Xamarin. Xamarin is "almost native" to iOS and Android. To achieve this, Xamarin uses a method that supports invoking developers directly from C # with all the APIs of objective C/swift for iOS and Java for Android. Standard user interface controls that are available to native developers and can be accessed through Xamarin. This way, once the application is running on the device, the correct perception is given.

Although you can implement almost all of the features in C #, it may still require a small amount of native code. For an experienced Xamarin developer, this is undoubtedly a benefit in application development, as they can determine the invocation situation based on their past experience.

where Xamarin is used

Xamarin has a robust back-end architecture that is ideal for developing enterprise applications and any applications that require a lot of back-end development. While Xamarin has some limitations in the need for a feature-rich user interface, Xamarin can still generate some very attractive applications. Later in this article, we will give some case studies.

The biggest advantage of Xamarin is the development time and the efficiency of cross-platform work. Due to the intense competition, most mobile application projects give a deadline, and the development speed of Xamarin developers is undoubtedly excellent. Another advantage of Xamarin is that it can use the Estimote SDK to integrate IoT devices such as beacons and smart glasses.

The fact that Xamarin is operating in the Microsoft ecosystem is also a big advantage for businesses. Most of these companies have invested in products such as Visual Studio and are likely to have a stable. NET development team.

Xamarin has its shortcomings.

Here are some bad news. Xamarin is not the best option in the following situations:

    • The UI interface is complex (consumer-to-consumer situations);
    • Lots of animations and graphics (for example, games);
    • Still need some native programming in case;
    • When the application will develop into a large scale;
    • Requires the use of a specific open source software library;
    • If the developer is unwilling to pay the license fee for Xamarin.
Complex UI Interface

If your app targets end users and needs to provide rich front-end functionality, it is recommended that you use native apps. The xamarin.forms is enough to handle a simple user interface and can benefit from Xamarin's superior back-end functionality. But when it comes to applications that require complex user interfaces, Xamarin cannot rival the native SDK. This is because the UI of iOS and Android must be designed and implemented separately based on the look and feel of the respective platform, and end up with less than half of the application code that can be shared, less than 75% of the normal case, or 100% near the use of forms. This is completely against our intention to use Xamarin. Therefore, you should use Objective C or Java at this time.

Graphics and animations

Xamarin is also not a good choice for developing game apps. Xamarin does not work for apps that require powerful graphics or animations. Nonetheless, we cannot completely exclude the use of Xamarin to develop games. An example of this is the bastion display of the game on the ipad. In addition, the latest development of Xamarin will make this situation change.

Figure 8 Bastion shows the game on ipad (image source: Jo Ann Buckner article on the official Xamarin blog)

Not a 100% solution

As we mentioned earlier, in some cases, to build a complete solution, we may still need to write a small amount of native code. This means that developers still need some native skills, which reduces the benefits that Xamarin offers.

Access restrictions on the open source software library

Native developers can use all open source repositories available on the target platform. However, Xamarin developers can only use the open-source repositories in the Xamarin environment, which typically has fewer numbers. With the growing popularity of Xamarin, it is expected that this problem will gradually disappear in the future. As the latest development of NuGet shows.

The Xamarin app is a big size

Xamarin apps will be larger in size. Developers may need to do some extra work to optimize the size of the app. If an app is too large, the installation will take more time and may cause storage and access issues on the customer's phone, which can lead users to consider deleting the app.

Xamarin may be free, but Visual Studio is not free

Because Xamarin is bundled in Visual Studio, developers will find it necessary for Visual Studio Professional or Enterprise Edition to use the required functionality. Although entry-level products are free, there is certainly no feature in all of them.

Xamarin offers standard licensing and cloud licensing, and their prices are not cheap. A quote for the standard license is displayed for the reader's reference.

Figure 9 Xamarin Licensing Quote (Image source: Xamarin official website)

Some success stories using Xamarin

Below we have selected several companies in different industries as examples. These companies use Xamarin to achieve satisfactory results.

Siemens PLM

Figure Ten Siemens PLM application example (image source: Kyle Maxey post on engineering.com)

Siemens PLM is a large portfolio of expensive engineering software with over 9 million seats and 77,000 users worldwide. Siemens hopes to further expand the company's market with a lightweight mobile drawing and CAD application called "Catchbook". In your app, users can draw shapes with their fingers or stylus. Siemens chose Xamarin, considering that the company has Microsoft's development skills and does not have the development skills of iOS or Android. The first advantage that Xamarin offers is that companies can port many of their existing code. Second, businesses avoid the hassle of learning native iOS and Android development languages, allowing 75% of apps to run.

Bank

Figure 11 World Bank Application Example (Photo source: Ann Buckne article published on Xamarin's official blog)

The World Bank has a small development team composed of 8 developers. Team members are familiar with Visual Studio and C # development, so teams can use Xamarin to quickly increase productivity. They developed a complex survey system for Android device applications only. This is because the World Bank is faced with developing country users, the Android system they primarily choose the type of phone.

Coca-Cola Bottling Company

Figure 12 Coca-Cola Bottling Company Application Example (image source: Lacey Butler published in the Official Xamarin blog article)

In just four months, the world's largest Coca-Cola bottling company put the "MarketPlace" application in operation. As in the case described earlier, the company has. NET and C # skills, they are very familiar with visual Studio, which is why companies are interested in using Xamarin. The company introduced two experienced Xamarin developers to guide the team (by the way, they used slack in team work.) Slack is also used by Xamarin).

Community Comment Status

Because of its agility, Xamarin makes it possible to run the product in the shortest possible time, so it is highly acclaimed in some mobile application development companies. Here are some comments in the Clutch review forum.

"for having. NET and C # experience, they want development tools to integrate the Microsoft technology stack backend. Xamarin is undoubtedly an excellent tool. ”

"By partnering with Xamarin, we have successfully delivered a large number of mobile applications. These applications are highly appreciated by our customers. For example, one customer wants to deliver an app in half the normal time, because the app will show up in a large event. It is because Xamarin allows us to share code seamlessly, which allows us to complete the task within a deadline. The customer was very happy. In the face of such time pressure, using Xamarin is always more advantageous. ”

"As mentioned earlier, the biggest problem with Xamarin is that when it comes to graphics or applications that require a high degree of automation, there are some problems. ”

Conclusion

Although Xamarin is not intended for any mobile app, it is really the company's consideration in choosing mobile app development. Applications can be quite complex, as shown in the enterprise case given above. In a corporate environment, Xamarin uses C # as the preferred language, which makes it stand out among many competitors. The market has also been growing rapidly since the acquisition of Xamarin by Microsoft. For existing customers, this is undoubtedly a good news.

Figure of the market growth of Xamarin (Photo source: Matt Larson at the Xamarin experience London 2017 Conference PowerPoint presentation)

About the author of this article

Adriana Blum is a senior technical architect at Mobile application development company Iflexion. She has more than 13 years of experience in managing and delivering customized mobile solutions. She is helping companies automate their processes, find new opportunities, and create applications that bring high value to the business.

View English Original: Mobile cross-platform development with Xamarin

Use Xamarin for cross-platform mobile app development (reprint)

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.