Understanding MVVM and MVC
In software design, we usually follow and reuse good practices and design patterns. The Model-View-Controller (MVC) pattern is an approach to decoupling the responsibilities of a system. It can help to separate the implementation of the UI and the business logic into different parts.
Figure 4.1: The MVC pattern
The MVC pattern, as shown in Figure 4.1, divides the responsibilities of the system into three distinct parts:
- Model: The model represents the data and the business logic of the application. It is responsible for storing the app’s data, handling data validation, and performing any necessary data processing. Model classes typically interact with data sources, such as databases, web APIs, or file storage, to fetch and store data. Model classes usually can be implemented as Plain Old CLR Objects (POCOs) or Data Transfer Objects (DTOs). POCO is a class that doesn’t depend on any framework-specific classes, so POCO...