The Model, View, ViewModel (MVVM) pattern was introduced by Microsoft with Windows Presentation Foundation and has become the standard for apps developed using XAML. It’s a popular pattern with enough nuance that entire books have been dedicated to the subject. This chapter will provide an introduction, and as you progress through your .NET MAUI journey, you may find that you want to explore this topic in more depth.
The use of the MVVM pattern is, in some ways, more of an art than a science. You should aim to understand the rules about separating UI logic, presentational logic, and business logic if you are adopting the MVVM pattern in your app. Of course, blind adherence to any pattern is an antipattern, and you should prioritize ensuring that your code is readable and maintainable. But you can’t make an informed decision about when to deviate from the pattern if you don’t understand it well.