Introduction to MVC

Introduction to MVC

·

2 min read

What is MVC?

MVC stands for Model View Controller. It is one of the most frequently used Software Architectural Design Pattern. There are 3 main components -

1. Model is responsible for the data logic or represents a table of any database. It is a logical component of any database table.
2. View is a representation of information and is used for all the UI logic of the application. Actually it is an user interface that the user sees and interacts with in the application.
3. Controller is responsible for any logical operation behind the scene.

How it works?

1. Model receives command(s) from controller and acts according to the command(s) like insert, update, delete and return data.
2. View is a representative of User Interfaces. It shows information using texts, media file(s), table, chart etc to interact the user(s). It works according to the command(s) received from controller.
3. Controller receives a request from from any browser/client and process it with it's own logic written by developer. It sends command(s) to model or view or both according to the request.

Work flow:

  1. CMCVC
    • Client / browser ( Controller Model)1+ Controller (View Controller )1+ Client / bowser.
    • Client / Browser

      Controller
      Model

      View
  2. CMC
    • Client / browser (Controller Model Controller )1+ Client / bowser.
    • Client / Browser

      Controller

      Model
  3. CVC
    • Client / browser (Controller View Controller )1+ Client / bowser.
    • Client / Browser

      Controller

      View

MVC.png

[References: Pictures collected from google and youtube]