Let’s Have A Look At MVC (Model View Controller) Architecture

Reading Time: 3 minutes

MVC Architecture or Model View Controller Architecture is an architectural pattern where the application is separated into three important parts: The model part, the view part, and the controller part. Nowadays this Architecture is widely used to develop mobile and web applications. If you are interested in web development or mobile application development then this blog can help you to know about the basics of Model View Controller Architecture.

components of mvc

What is MVC Architecture?

As stated earlier MVC is an architectural pattern where the application is separated into the following three important parts:

  • Models
  • Views
  • Controllers

Model View Controller architectural pattern is used for relating the (User Interface) of an underlying data models and organizing to relate the application code.
It is one of the most used industry-standard web development frameworks which is used to create scalable projects. The following are the popular framework that uses Model View Controller Architecture :

  • Play Framework
  • React
  • AngularJS
MVC flow

Model :

Model is the lowest level in MVC and it is responsible for maintaining and handling the data. It is directly connected to the database. The operation like adding and retrieving data is done by the model component. The model takes requests from the controller component and on the basis of that, it gives back the response data.

Controller :

Controllers are the only component that directly takes requests from the user. It also acts as an interface between Model and View components. The controller process the request and then manipulates data using the model component. It also interacts with the Views to give the final output.

Views :

The last component of MVC is Views. It generates UI or user interface for the user. View is created using the gata which is collected from models. It is not directly connected to the model component, so it takes data from models through the controller.

Working of MVC Architecture?

MVC FLOW

The following is the process of how Model View Controller performs a task:

  1. The client browser sends request to the Model View Controller Application.
  2. This request firstly performs routing based on the URL of the request of client.
  3. When outing operation is done it calls the controller which is appropiate for the task and execute it.
  4. The Controller component then process data using Model.
  5. The processed data from Model is then passed to the View through Controller, which in turn renders the final output.

Advantages of Model View Controller

The following are the advantages of using Model View Controller:

  • Model View Controller architecture will separate the user interface from business logic and business logic
  • We can easily reuse component of MVC whenever we need to. .
  • Model View Controller Components can be deployed and maintained independently .
  • We can test all the components independently.
  • Supports Asynchronous Method Invocation
  • In the Model View Controller architecture, developing different view components for your model component is easily achievable.

Conclusion

We get a basic knowledge of MVC Architecture and get familiar with the component of MVC i.e. Model, View, and Controller. This Blog gives us a basic understanding of Working of MVC Architecture and tells us about the advantages of it

Written by 

Divyansh Devrani is a Software Consultant having experience in the Scala Ecosystem. He has worked on technologies like Scala, Akka, Play, and Postgre. He is recognized as a good team player who wants to interact with new technologies. He loves to learn new things His hobbies include listening to muisc, watching movies and anime.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading