Reviewing the MVC pattern
The Model-View-Controller is one of the preferred patterns for implementing client/server architectures for the Web. To simplify slightly, its purpose is to segregate responsibilities across three roles:
- Models which encapsulate the logic and behavior rules that are not part of the interface of the system (note that interface in this context refers to programming/user interfaces rather than interfaces that define contracts classes must implement);
- Views that render domain models or Data Transfer Objects (DTOs) as part of the interface;
- Controllers that handle serialization of user input and the creation of views from user actions, and which in Web environments also handle initial requests.
The following diagram shows a simplified version of the pattern:

Figure 7.1: MVC pattern
This pattern has many variations. In the Django framework it is recognized as Model-View-Template (MVT), with Django’s Views being...