29,99 €
In today's fast-paced world of modern software development, teams need to be efficient, productive, and capable of rapidly adapting to changes to deliver high-quality products, making it crucial for developers to write maintainable and easy-to-test code.
The MVVM Pattern in .NET MAUI helps you to thoroughly explore the Model-View-View Model (MVVM) design pattern. The chapters show you how this pattern helps in structuring code to embrace the separation of concerns, allowing for loosely coupled user interface and application logic, which ultimately empowers you to write more robust, maintainable, and testable code. The book also highlights .NET MAUI's capabilities and features, and enables you to delve into the essential components within the framework that facilitate the application of the MVVM pattern. With the help of a sample application, this definitive guide takes a hands-on approach to walk you through both the essential and advanced usages of the MVVM pattern to ensure that you successfully apply the practical aspects of the pattern to your .NET MAUI projects.
By the end of this book, you’ll have gained a comprehensive understanding of the MVVM design pattern and its relevance in the context of .NET MAUI, as well as developed the skills needed to successfully apply it in practice.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Veröffentlichungsjahr: 2023
The MVVM Pattern in .NET MAUI
The definitive guide to essential patterns, best practices, and techniques for cross-platform app development
Pieter Nijs
BIRMINGHAM—MUMBAI
Copyright © 2023 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Group Product Manager: Kunal Sawant
Publishing Product Manager: Akash Sharma
Book Project Manager: Prajakta Naik
Senior Editor: Esha Banerjee
Technical Editor: Maran Fernandes
Copy Editor: Safis Editing
Proofreader: Safis Editing
Indexer: Pratik Shirodkar
Production Designer: Nilesh Mohite
Marketing Coordinator: Sonia Chauhan
First published: November 2023
Production reference: 1101123
Published by Packt Publishing Ltd.
Grosvenor House
11 St Paul’s Square
Birmingham
B3 1RB, UK
ISBN 978-1-80512-500-6
www.packtpub.com
To my son, Gust, whom I had to disappoint too often while I was working on this book. Now I have time to play, let’s go!
– Pieter Nijs
Early in my career as a self-taught software developer, I realized I had a poor grasp of the terms being used by developers around me to describe application architecture. The role and responsibility of a View were obvious to me, but what about a model, presenter, mediator, service, factory, controller, or any number of other things? And what a ViewModel was really threw me! I often felt paralyzed about how to apply a pattern, which greatly slowed me down. I eventually discovered that while there are some rules you must not break, many things are also permissible once you understand the purposes behind a pattern.
Oh, how I wish I had had access to Pieter’s book back then! He would have saved me a ton of time and spared me so much confusion.
I have interacted with Pieter for many years through the .NET community, and I know the size and scope of projects that he has been involved with. For that reason, I’m confident he’s well suited to not only explain the MVVM pattern but to do so in a way that conveys the real-world application of it. This book will help you understand why the pattern exists, and whether to use it or not.
Of course, I’m thrilled that Pieter is teaching MVVM while also introducing you to the awesome power of .NET MAUI for building mobile and desktop applications. MVVM is by far the most common pattern we see used with .NET MAUI and is what we use in most of our product samples at Microsoft.
I can’t wait to see what you build with .NET MAUI! Happy coding.
David Ortinau
Principal Product Manager @ Microsoft for .NET MAUI
Pieter Nijs is a .NET consultant at Xebia in Belgium, with a keen interest in mobile and cloud development. He’s been instrumental in diverse projects, from vast healthcare and telecom systems to compact LOB apps. Now, Pieter’s exploring AI’s potential to enhance customer projects innovatively. Passionate about technology, he actively experiments and shares knowledge as a conference speaker, trainer, and blogger at blog.pieeatingninjas.be. Pieter has been awarded the Microsoft MVP Award since 2017, reflecting his unwavering passion and expertise in serving the community.
Thank you, Stefanie, my constant, not just in the process of writing this book but in every step of life. Your unwavering love, encouragement, and belief in me have been the driving force behind everything I do and achieve, not just this book. I cannot measure your impact in mere words. Thanks also to my parents, who gave my brothers and me endless opportunities and a strong foundation.
Gerald Versluis is a Senior Software Engineer at Microsoft working on .NET MAUI. Since 2009 Gerald has been working on a variety of projects, ranging from frontend to backend and anything in between that involve C#, .NET, Azure, ASP.NET and all kinds of other .NET technologies. At some point, he fell in love with cross-platform and mobile development with Xamarin, now .NET MAUI. Since that time, he has become an active community member, producing content online and presenting about all things tech at conferences all around the world.
Gerald can be found on X (formerly Twitter) @jfversluis, blogging at https://blog.verslu.is, or on his YouTube channel: https://youtube.com/@jfversluis.
In this part, we start by discussing the Model-View-ViewModel design pattern without tying it to a specific platform. Next, we'll introduce the .NET MAUI framework and highlight why it works so well with MVVM. As we move forward, you'll learn about the benefits of community toolkits and get hands-on experience with collections. This foundation sets you up for more advanced topics later on.
This part has the following chapters:
Chapter 1, The MVVM Design PatternChapter 2, The .NET MAUI FrameworkChapter 3, Data Binding Building Blocks in .NET MAUIChapter 4, Data Binding in .NET MAUIChapter 5, Community ToolkitsChapter 6, Working with Collections