As part of the series of posts announced at this initial blog post (.NET Application Architecture Guidance) that explores each of the architecture areas currently covered by our team, this current blog post focuses on “Mobile Apps with Xamarin.Forms: Architecture and Patterns guidance“.
Just as a reminder, the four introductory blog posts of this series are (or will be as of today) the following:
- Microservices and Docker containers: Architecture, Patterns and Development guidance
- Web Applications with ASP.NET Core Architecture and Patterns guidance
- Mobile Apps with Xamarin.Forms: Architecture and Patterns guidance
- Modernize existing .NET apps with Windows Containers and Azure
There are many issues that must be resolved when creating an enterprise mobile app. These include:
- Deciding how to provide a clean separation of concerns between the user interface controls and their logic.
- Deciding whether to use a dependency injection container.
- Choosing how components that are inconvenient to link by object and type references can communicate.
- Deciding how to navigate between pages, including how to invoke navigation and where navigation logic should reside.
- Deciding how to validate user input for correctness. The decision must include how to validate user input and how to notify the user about validation errors.
- Deciding how to perform authentication and how to protect resources with authorization.
- Deciding how to access remote data from web services, including how to reliably retrieve data and how to cache data.
- Deciding how to unit test the app.
Introducing the ‘Enterprise Application Patterns using Xamarin.Forms’ Guide/eBook
You can download this eBook that offers guidance on core patterns and architectural guidance for developing Xamarin.Forms enterprise apps that are easier to test, maintain, and evolve. Guidance is provided on how to implement the Model-View-ViewModel (MVVM) pattern, dependency injection, navigation, validation, and configuration management, while maintaining loose coupling. In addition, there’s also guidance on performing authentication and authorization with IdentityServer, accessing remote data from containerized microservices, and unit testing.
The eBook comes with source code for the eShopOnContainers Xamarin.Forms mobile app, which is a mobile app that extends the eShopOnContainers microservice/containers scenario. This mobile app includes the following functionality:
- Authenticating and authorizing with a backend service.
- Browsing a catalog of shirts, coffee mugs, and other marketing items.
- Filtering the catalog.
- Ordering items from the catalog.
- Viewing the user’s order history.
- Configuring settings.
Who should use this guide
We wrote this guide for mobile app developers and solution architects who are new to Xamarin.Forms while looking to learn and adopt proven enterprise architectural/design patterns and best development practices for Xamarin.Forms apps.
Related sample mobile Xamarin.Forms app
The eBook focuses on building cross-platform enterprise apps using Xamarin.Forms and uses the eShopOnContainers mobile app as an example. The following diagram shows the pages from the eShopOnContainers mobile app that provide the functionality outlined earlier:
The mobile app consumes the backend services provided by the containerized microservices. However, it can also be configured to consume data from mock services for those who wish to avoid deploying the backend services and just want purely explorer the Xamarin.Forms mobile app without the hassle of deploying a microservice-based backend.
Wrapping up – Xamarin.Forms Patterns guidance
Enterprise Application Patterns using Xamarin.Forms focuses on core patterns and architectural guidance for developing Xamarin.Forms enterprise apps that are easier to test, maintain, and evolve. Guidance is provided on how to implement MVVM, dependency injection, navigation, validation, and configuration management while maintaining loose coupling. In addition, there’s also guidance on performing authentication and authorization with IdentityServer, accessing remote data from containerized microservices, and unit testing.
Visit the .NET Application Architecture Center and grab it all!
Remember that this ‘Web Applications with ASP.NET Core Architecture and Patterns guidance’ explained at this blog post is part of a broader .NET Architecture guidance which covers additional subjects and you can check out at the .NET Application Architecture Center page where you can download the multiple eBooks/Guides and visit the reference applications from there, and of course, feel free to provide feedback by dropping a note below or on the feedback form at the architecture page.
Happy coding from the .NET team!
Cesar de la Torre
.NET Product Group