Books to Read

Introduction

The objective of our second MAUI project is to get acquainted with the MVVM (Model-View-ViewModel) design pattern. The main purpose of MVVM is separation of concerns. With MVVM we will end up with smaller classes with less code. Using this pattern or not is a matter of personal style, but it’s widely adopted in enterprise because of the complexity of the domain. A large code base without separation of concerns in mind quickly turns into spaghetti: code that is less maintainable and testable. Smaller classes and methods with clear responsibility mean they’re easier to test.

It does take a while to get used to MVVM, though. And it’s perfectly ok to feel lost at first. The learning curve can be steep, especially after doing so many projects using MVC. A mindset shift is needed. However it will pay off. MVVM is also used in Blazor and the previous .NET native solutions (WPF, Xamarin, WinUI), so this knowledge won’t be restricted to MAUI projects.

Requirements

  • As a preparation for this project, you should complete the Todo List tutorial by James Montemagno (link in the resources area)
  • This is a very simple app where you'll record data about books you want to read.
  • It should be similar to a todo list, but just for books.
  • Users should be able to perform all CRUD operations against the database.
  • To keep things simple and focus on MVVM, you'll have just one "books" table.
  • You should use the MVVM pattern.
  • You should use SQLite.

Resources

With the Math’s Game project, you learned the basics of MAUI and XAML. Now you’ll need to add a design pattern to that knowledge. For that we will get the help of the most knowledgeable MAUI instructor out there: James Montemagno. Initially, you’ll follow his Beginners MAUI tutorial, where you’ll build a Todo List App with MVVM.

What you'll learn

  • The Books Management app can be almost identical to the Todo List project by James Montemagno, with just a few tweaks.
  • Take your time learning MVVM. Understand every line of the code. Google everything you don't know. Write diagrams, make notes and lists.

Challenges

  • Add a "photo" property to the book detail. It will contain an URL to a picture of the book's cover.
  • Expand on the project fetching and using data from a books API.
  • Create a search functionality where I can query for titles or dates of books previously read (and whatever other filters you can think of).
  • Create a "Reading now" functionality where you can track your progress in a book you're currently reading
Log in to mark this article as read and save your progress.
An unhandled error has occurred. Reload 🗙