Model View Controller ( MVC )

Maria Asghar
2 min readFeb 9, 2021

Model-View-Controller (MVC) is a software design pattern that logically divides the application into three interconnected components.

  • Model
  • View
  • Controller

MVC helps developers to develop, maintain and update the application easily as it separates the internal logic from user interface.

This post is a brief overview of MVC. This includes description of the major functions of MVC’s components and then a walkthrough of its process.

Functionality

These three components have different functionalities.

  • Model deals with the data logic and handles the database.
  • View makes the data presentation for user
  • Controller deals with user request and send instructions to model and view accordingly

PROCESS

Overview of MVC
  1. Browser sends the user’s request to controller
  2. Controller interprets the user request and send instructions to model to get data
  3. Model deals with data logic and send the required data to controller
  4. Controller sends the received data from model to View in order to get presentation
  5. View uses that data and makes presentation accordingly. Then it sends that presentation to controller
  6. Finally, Controller sends that final presentation back to user/browser as a response.

Conclusion

User interacts through the browser and then browser sends the request to controller. Controller deals with both model and View. Model deals with database while controller and view don’t have access to database. Controller receives the data sent by model which is the same data that controller sends to view. We can say that view is indirectly connected to model through the controller. View makes the presentation and then controller sends that to user. I hope this post gave you a basic overview of MVC. For further details and history of MVC you can go through the resources.

Happy Learning!

Resources

History of MVC

Detailed Description

--

--