Loading...

What is Model, View, and Controller (MVC) Architecture? (2024)

Uvision Blogs Details

What is Model, View, and Controller (MVC) Architecture?

Today we are going to learn about what is model, view, and controller (MVC) architecture. MVC is an architectural pattern, which represents three parts Model, View, and Controller, or to be more exact it divides the application into three logical parts. The model part, the view, and the controller. It was used for desktop graphical user interfaces but nowadays is used in designing mobile apps and web apps. So let’s start to learn MVC.

Frameworks.

Some web frameworks that use MVC concept.

  • Ruby on Rails
  • Laravel
  • Codeigniter
  • CherryPy
  • Django
  • CakePHP, etc.

MVC History

MVC architecture first deliberated in 1979 by Trygve Reenskaug. MVC model was first announced in 1987 in the Smalltalk programming language. MVC was first time accepted as a general concept, in 1988. In the current time, the MVC pattern is widely used in modern web applications

MVC Features

Testability: Greatly testable, extensible, and pluggable framework.

HTML and URLs: Offers full control over your HTML as well as your URLs.

Separation:  separation of logic: Model, View, And Controller. Separation of application tasks viz. business logic, Ul logic, and input logic.

Routes: URL Routing for SEO Friendly URLs. Great URL- representing for understandable and searchable URLs.

Model View Controller (MVC) Architecture.

controller model view MVC architecture

MVC Architecture has three main components.

Model: It includes all the data and its related logic means to maintain DATA.

View: Present data to the user or handles user interaction or Data representation is done by the view component.

Controller: An interface between Model and View components.

Let's see each other this component in detail.

Model

This MVC module stores data and its related logic. It represents data that is being transmitted between the controller part and any other related business logic. For example, a Controller object will fetch the customer info from the database. It controls data and sends it back to the database or uses it to render the same data.

It responds to the request from the views and also responds to instructions from the controller to update itself. It is also the lowest level of the pattern which is responsible for maintaining data.

View

Data representation is done by the view component. It actually generates UI or user interface for the user. So at web applications when you think of the view component just think the Html/CSS part. Views are created by the data which is collected by the model component but these data aren’t taken directly but through the controller, so the view only speaks to the controller.

Controller

The controller act as an interface between Model and View modules to process all the business logic and incoming requests, manipulate data using the Model component, and interact with the Views to render the final output. For example, the Customer controller will handle all the interactions and inputs from the Customer View and update the database using the Customer Model. The same controller will be used to view the Customer data.

Other related posts.

How to install WordPress using Cpanel

How to install WordPress on localhost or window

How to upload website using cPanel and how to create FTP account in cPanel

In short

The MVC is an architectural pattern that separates an application into

1. Model

2. View

 3. Controller

Model: It includes all the data and its related logic.

View: Present data to the user.

Controller: An interface between Model and View components.

MVC architecture first discussed in 1979 by Trygve Reenskaug.

MVC is a highly testable, extensible, and pluggable framework.

Some popular MVC frameworks are Rails, Zend Framework, CodeIgniter, Laravel, CakePHP, etc.

model view controller MVC architecture

We hope you may learn what is model, view, and controller (MVC) architecture. Please share your thoughts and queries in the contact section.