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 stores the application data and processes business logic. 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 classes can be used with LINQ or Entity Framework well. DTO is a subset of a POCO class that only contains data without logic or behavior. DTO classes can be used to pass data between layers. The model has no dependency on the view or the controller so it...