Codecademy Logo

How to Structure Your Apps

MVC Design Pattern

MVC is a software design pattern that organizes an application into three types of components (Model, View, and Controller) based on their functionality.

The View Component

In the MVC pattern, the View handles the application’s visual presentation. The View components display the Model’s data and communicate user actions to the Controller.

The Controller Component

In the MVC pattern, the Controller defines the behavior of an application and communicates with both the Model and the View. Controller components are responsible for communicating with the Model and handling user interactions from the View.

Pros and Cons of MVC

Following the MVC pattern adds complexity to a project’s organization, but separating concerns offers the developer more flexibility in implementing each component and simplifies making changes later on.

0