📜 ⬆️ ⬇️

The evolution of cross-platform development: the pros and cons of Xamarin



Like an era in our own history, when four-legged mammals made a leap in evolution and became two-legged, Xamarin.Forms tries to leave its mark in the history of software development, architecture and design. Thanks to its capabilities, we can easily develop an application (having previously created a unique design for it) that can work on three different operating systems with the same C # code base and user interface, and for which the possibility of code reuse and customization is provided.

I also decided to take part in this important milestone in the development of software development. After I developed an application that helps me monitor the health of patients, I decided to share my opinion on the pros and cons of Xamarin.
')

Weigh all the pros and cons of Xamarin


What I managed to create


In recent years, I have devoted most of my time to health issues. I was inspired by the idea of ​​developing something new that would allow me to more effectively monitor the health of patients, as well as record their biometric data. For this purpose, I have developed a panel for collecting patient health data. Thanks to her, you can collect information about patients: their cholesterol level, waist-to-hip ratio, body mass index and heart rate, as well as track any changes in the parameters given during a certain period.

All tracked indicators are displayed in a square grid with nine cells. The user selects the desired cell (for example, a cell with indicators of cholesterol levels), which he would like to track. After selecting such a cell, the following screen appears before the user.

Being in the main menu, the user receives color signals if an update is required for any indicators. Indicators that have been introduced recently are displayed in bright green, but over time, the color fades to black. After the indicator has turned black, it needs to be updated. The panel also displays the history of the entered indicators. In the future we plan to add more graphics to the panel interface.

Disadvantages and advantages: development for Android was more convenient than for iOS


First of all, I started developing and testing my application using Xamarin.Forms for Android. It just so happened that before that time I, for the most part, wrote various applications for iOS on Objective-C. I had to install Visual Studio on my Windows and use it to implement my idea. Since the Android emulators were very, very slow, I had to take the path of least resistance: I followed the work process and checked the functionality of the application on a regular Android phone, since debugging using a Windows phone is supported only for Android devices.

To check the development of the cherished iOS panel, I had to devote a bit more free space. While I continued to develop on Windows, my iPhone, used for debugging, should have been permanently connected to a Mac (or to a working host). Then, I connected my Mac to the same Wi-Fi network that my computer was connected to, which was used directly for development. What for? It's simple: during the development and debugging of the Visual Studio IDE and Mac had to interact. Using an SSH connection, I managed to “make friends” with Visual Studio and Mac OS by setting access to the Apple compiler, as well as tools for signing executable code.

The difference in my experience testing applications for Android and iOS is, in fact, insignificant. While debugging an iOS application, I had to stay in the same room all the time, since my computer was connected to a working node. As for Android, I felt much freer, and testing happened many times faster: I updated the applications, turned to another device and started the application again. Thus, I decided that, first of all, I will develop and test the application for Android. As for my experience with Xamarin, such advantages and disadvantages were the most significant during all my work with this platform.

Benefits: providing functionality through embedded Xamarin.Forms layouts


To develop a panel for collecting patient health data, I used layouts built into Xamarin.Forms using user interface code. I chose a built-in layout with a linear arrangement of objects with nested grid layouts. To do this, I created my own classes of layouts, thanks to which I achieved more functionality. I also developed a general view of “cells” in grids that would relate to a specific indicator under study, so most of the code for a cell (including the designation of limits for measuring any of the indicators, as well as determining its color) was also used by me to design other cells .

What is important, while developing my idea with the help of Xamarin.Forms, I wrote code that kind of says: “For me, create a new line for the first cell, and a grid for the second cell”. This approach seems to me very convenient for developers who are used to writing their own and to understand someone else's code. Nevertheless, it seemed to me normal to write my own page layout, especially if in the future you have to make corrections in the code and once again change the layout. If you have no other reason than using the XAML designer, I would advise you to still write layouts for screens.

Imagine my surprise when I, having just written a draft version of my Android application, discovered that its orientation changes with the rotation of the device. The design of embedded layouts Xamarin was designed to be responsive and so that the application completely fills the screen of the device. Personally, I was not going to engage in support for changing the screen layout. As far as I know for development teams using Xamarin, such features of this platform are a lot of time saved. I was even more surprised when I installed the application on my iOS gadget and found that it works and all its responsive features remain!

Pros / cons: addressing the issue of limitations using the Model View ViewModel


Since I didn’t use a designer to work on my project, the classic confusion between the developer and the designer (for example, the designer provides the UX / UI design layout to the developer who cannot implement it in practice for a number of technical reasons). Proper interaction between designers and developers is the key to achieving elegant UI design using Xamarin.Forms.

When developers start working on the mobile version of the application using Xamarin.Forms, they should, first of all, thoroughly consider what the common features will look like for devices of the most common systems: iOS, Android and Windows. Each developer should ask himself: “Is the functionality of the application supported, and are all its elements in place, when working on any systems? How can this be achieved?

Such a process requires more organization, as well as in-depth knowledge of the interaction schemes in all three operating systems. While developing an application, you need to be guided by solutions that are universal for all possible operating systems, and not to bet, for example, only on Android, while completely forgetting about the users of iOS devices.

And yet, I didn’t bet on UX design for my simple application, since developing a flexible layout using Xamarin.Forms was an undeniable advantage that allowed me to reuse code more efficiently, saving 80–90% of the time. In addition, some features of the behavior of a particular system can be monitored using the DependencyService in Xamarin.Forms.

Instead of throwing all your strength on UX / UI-design, try to understand the limitations for one or another operating system. By doing this, you will undoubtedly be able to create truly worthwhile things, despite such boundaries. Of course, such concessions made to achieve the benefits of using Xamarin.Forms cannot be the deciding factor. However, it is worth noting that if a more specific system specificity is required, then developers can create their own render.

Design Principles with Xamarin.Forms


(Attention, spoiler from the developers!) Below are examples of best practices for frames and aesthetic layouts for Xamarin:


Pros and cons: add animation during download for your users


At the end of this article, I want to advise you also to pay attention to what we are faced with from the very beginning - the waiting time required for downloading the application. After I finished work on my dashboard, I noticed that it took a little longer to load it than I expected: it would display the results from the server for display. If from the very beginning I would add the animation displayed during the download process, then such a delay would go unnoticed. This is, of course, a minor detail in discussing the advantages and disadvantages of Xamarin, but even the smallest detail matters.

- Bourge Traffic from Reddit, Medium, Bitcointalk .

Source: https://habr.com/ru/post/338040/


All Articles