MVC Architecture
When following the Model-View-Controller (MVC) architecture, you divide your code into three parts:
- Model - stores data, performs calculations
- View - handles user input and output
- Controller - controls the flow of the program
In this organization, the Model and View components never communicate. Instead, the Controller gets input from the View and gives it to the Model. Then it gets results from the Model and gives them to the View to display.
In larger programs, the Model, View, and Controller component will likely be several classes each. However, in our first examples, we will use one class for each component.