MVC — Model View Controller
When the Django Template Knew Too Much
Table of Contents
The Three Roles
┌───────────────────────────────────────────────────────┐
│ User Interaction │
└───────────────────────────┬───────────────────────────┘
│ input (click, form submit)
▼
┌───────────────────────────┐
│ Controller │
│ - Receives user input │
│ - Validates input │
│ - Invokes model │
│ - Selects view to render │
└──────────┬───────┬────────┘
│ │
updates │ │ selects
▼ ▼
┌──────────┐ ┌──────────┐
│ Model │ │ View │
│ - Data │────▶│ - Render │
│ - Rules │reads│ - Display│
│ - State │ │ - Format │
└──────────┘ └──────────┘Request Flow
MVC in a Web Framework Context
Framework
Model
View
Controller
Python Example: FastAPI MVC
TypeScript Example: Express MVC
MVC vs MVP vs MVVM
Concern
MVC
MVP
MVVM
Common Violations
Lessons Learned
Last updated