Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mobile Development with .NET

You're reading from   Mobile Development with .NET Build cross-platform mobile applications with Xamarin.Forms 5 and ASP.NET Core 5

Arrow left icon
Product type Paperback
Published in Apr 2021
Publisher Packt
ISBN-13 9781800204690
Length 572 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Can Bilgin Can Bilgin
Author Profile Icon Can Bilgin
Can Bilgin
Arrow right icon
View More author details
Toc

Table of Contents (25) Chapters Close

Preface 1. Section 1: Understanding .NET
2. Chapter 1: Getting Started with .NET 5.0 FREE CHAPTER 3. Chapter 2: Defining Xamarin, Mono, and .NET Standard 4. Chapter 3: Developing with Universal Windows Platform 5. Section 2: Xamarin and Xamarin.Forms
6. Chapter 4: Developing Mobile Applications with Xamarin 7. Chapter 5: UI Development with Xamarin 8. Chapter 6: Customizing Xamarin.Forms 9. Section 3: Azure Cloud Services
10. Chapter 7: Azure Services for Mobile Applications 11. Chapter 8: Creating a Datastore with Cosmos DB 12. Chapter 9: Creating Microservices Azure App Services 13. Chapter 10: Using .NET Core for Azure Serverless 14. Section 4: Advanced Mobile Development
15. Chapter 11: Fluid Applications with Asynchronous Patterns 16. Chapter 12: Managing Application Data 17. Chapter 13: Engaging Users with Notifications and the Graph API 18. Section 5: Application Life Cycle Management
19. Chapter 14: Azure DevOps and Visual Studio App Center 20. Chapter 15: Application Telemetry with Application Insights 21. Chapter 16: Automated Testing 22. Chapter 17: Deploying Azure Modules 23. Chapter 18: CI/CD with Azure DevOps 24. Other Books You May Enjoy

Exploring cross-platform development

The term cross-platform application development refers to the process of creating a software application that can run on multiple operating systems. In this book, we will not try to answer the question of why, but how to develop cross-platform applications – more specifically, we will try to create a cross-platform application using the toolset provided by Microsoft and .NET Core.

Before we start talking about .NET Core, let's take a look at the process of developing an application for multiple platforms. Faced with the cross-platform requirement, the product team can choose multiple paths that will lead the developers through different application life cycles.

Throughout this book, we will have hypothetical user stories defined for various scenarios. We will start with an overall user story that underlines the importance of .NET Core:

"I, as a product owner, would like to have my consumer app running on iOS and Android mobile platforms, as well as Windows, Linux, and macOS desktop runtimes, so that I can increase my reach and user base."

In order to meet these demands, we can choose to implement the application in several different ways:

  • Fully native applications
  • Hybrid applications
  • Cross-platform

Let's take a look at each of these methods.

Developing fully native applications

Following this path would create probably the most performant application, with increased accessibility to platform APIs for developers. However, the development team for this type of development would require a wider range of skills so that the same application can be created on multiple platforms. Development on multiple platforms would also increase the developer hours that need to be invested in the application.

Considering the scenario presented in the previous section, we would potentially need to develop the client application in Cocoa and CocoaTouch (macOS and iOS), Java (Android), .NET (Windows), and C++ (Linux), and finally build a web service infrastructure using another development platform of our choice. In other words, this approach is, in fact, implementing a multi-platform application rather than a cross-platform one.

Hybrid applications

Native hosted web applications (also known as hybrid applications) are another popular choice for (especially mobile) developers. In this architecture, a responsive web application would be hosted on a thin native harness on the target platform. The native web container would also be responsible for providing access to the web runtime on native platform APIs. These hybrid applications wouldn't even need to be packaged as application packages, but as Progressive Web Apps (PWAs) so that users can access them directly from their web browsers. While the development resources are used more efficiently than in the native cross-platform framework approach, this type of application is generally prone to performance issues.

In reference to the business requirements at hand, we would probably develop a web service layer and a small Single - Page Application (SPA), part of which is packaged as a hybrid application.

Native cross-platform frameworks

Development platforms such as React Native, Xamarin, and .NET Core provide the much-required abstraction for the target platforms, so that development can be done using one framework and one development kit for multiple runtimes. In other words, developers can still use the APIs provided by the native platform (for example, the Android or iOS SDK), but development is executed using a single language and framework. This approach not only decreases development resources, but also saves you from the burden of managing multiple source repositories for multiple platforms. This way, the same source is used to create multiple application heads.

For instance, using .NET Core, the development team can implement all target platforms using the same development suite, thereby creating multiple client applications for each target platform, as well as the web service infrastructure.

In a cross-platform implementation, architecturally speaking, the application is made up of three distinct tiers:

  • Application model (the implementation layer for the consumer application)
  • Framework (the toolset available for developers)
  • Platform abstraction (the harness or runtime to host the application)

In this context, we, in essence, are in pursuit of creating a platform-agnostic application layer that will be catered for on a platform abstraction layer. The platform abstraction layer, whether we are dealing with a native web host or a native cross-platform framework, is responsible for providing the bridge between the single application implementation and the polymorphic runtime component.

.NET Core and Mono provide the runtime, while .NET Standard provides the framework abstraction, which means that cross-platform applications can be implemented and distributed on multiple platforms. Using Xamarin with the .NET Standard framework on mobile applications and .NET Core on the web infrastructure, sophisticated cloud-supported native mobile applications can be created.

As you can easily observe, native cross-platform frameworks offer the optimal compromise between development costs, performance, and the nativeness of the target application, providing developers with an ideal option for creating applications for multiple platforms. From this perspective, .NET (Core) and Xamarin, which together evolved into a cross-platform framework and runtime, has become one of the most prominent development platforms for mobile applications.

We have discussed different ways to implement cross - platform applications and identified the pros and cons of these methodologies. We can now start exploring the .NET ecosystem and cross-platform toolset.

You have been reading a chapter from
Mobile Development with .NET - Second Edition
Published in: Apr 2021
Publisher: Packt
ISBN-13: 9781800204690
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime