MVC explained!

Hi again,

Here’s a brief explanation of the Model-View-Controller architectural pattern popularly referred to as MVC.

MVC is a popular architectural pattern used in application development. This pattern divides the application into three parts that are dependent and connected to each other.

Why MVC?

Application development has really grown from what it used to be, and it continues to grow more complex. So, developers have come up with different patterns to layout projects and make development easier. MVC is the most popular pattern.

Now, let’s break it down.

The Model

This layer is where the business logic resides. Communication between the database and the application takes place here. The model is also responsible for handling data and implementing application logic such as validation, persistence, etc.

The View

This layer is where information is presented to the users based on the data the model fetches. In the case of a web app, the view is the webpage with which the users interact.

The Controller

This layer is where requests from users are handled and sent to the model. Furthermore, data from the model is sent to the view through the controller. Think of the controller as a “middleman”. With this design, the presentation of data and the logic of data are kept totally separate.

MVC aids collaboration between developers and provides a better debugging experience.

Further reading can be found on the Mozilla Docs.

Thanks for reading.

Free Resources