June 17, 2024

What is MVC

MVC is a software architectural pattern that separates the structure and behavior of the applications. It does this by partitioning the application into three component/parts: model, view and controller. MVC pattern is widely used in software development with many programming language like: java, C#, C, C++, PHP etc.  This article explains an introduction to Model View Controller MVC pattern. Summary of the article:

  • What is MVC?
  • What is Models?
  • What is Views?
  • What is Controllers?
  • History of MVC
Model View Controller MVC

What is MVC?
The MVC (Model View Controller) is a design pattern used in software engineering. These patterns propose there components or object to be used in software development:

  1. Model
    Model is the data access layer. This can be direct data access, web services, etc
  2. View
    View is the presentation layer of the application. This the users interface.
  3. Controller
    Controller is the business logic layer for the application. It controls Models & View.

MVC is a pattern for organizing codes in an application to improve maintainability. For understanding consider a photographer with his camera in a studio. A customer asks him to take a photo of his car. Here, car is the model, camera is the view, and photographer is the controller. All are completely independent. The car does not know anything about the photographer or the camera. This separation allows the photographer to go around the car and point the camera at any angle to get the shot/view that he wants.

In non-MVC architectures, every thing is integrated together tightly. If the car, the photographer and the camera were one object then, for a new view we would have to re-build the car and the camera.

A model represents the logical structure of data.

A view is the visual presentation of its model.

A controller controls the model and view. It is the link between the system and a user. It help users to provide input.

History of MVC
For the first time MVC Architecture was implemented by Trygve Reenskaug at 1979. It was implemented on Smalltalk at Xerox labs. The coders and software engineers accept the benefits and advantages of this architecture

That’s all about Model View Controller.

Rashedul Alam

I am a software engineer/architect, technology enthusiast, technology coach, blogger, travel photographer. I like to share my knowledge and technical stuff with others.

View all posts by Rashedul Alam →

6 thoughts on “What is MVC

  1. Short and nice article explaining separation of data, control and representation in a generic way for ease of maintenance. Thanks for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *