MVC (Model View Controller)

imtisal
3 min readDec 5, 2021

--

MVC was developed to separate the input process and output processes of an application. It is divided into three parts as model, view and controller. MVC is used for web application development.
• It is a software architectural pattern used to develop user interfaces.
• Its general purpose is to separate applications according to the way they work. It separates the interface and the logic part.
• It ensures that the codes can be read more easily and that the software has a modular structure.
• Thanks to MVC, the maintenance of the software is faster, and it is easier to fix a bug.
• Allows simultaneous changes in different parts of the written codes.
• It is the most used design pattern.
• Some Web Frameworks use MVC. Like Ruby, AngularJS, Django, Laravel.

Model: It is the logic and data processing part of the application. It interacts with the database and performs operations such as select, insert, update, delete. It communicates with the controller.

View: It is the interface that end users see. It is usually developed with HTML, CSS, JS. It communicates with the controller. It can take dynamic values ​​from the controller.

Controller: Receives the input from the user. Takes get, post, put, delete requests. It receives the data in the model and transmits it to the view. It is the control and decision part of the application.

• The user makes a request, the request goes to the controller. The data to be displayed in the View is taken from the model. The model gives the data it receives from the database to the controller, and the controller shows this data in the view.

Why Do You Need MVC?

MVC is being developed fast. Changes can be made to different parts of the same project at the same time, supporting parallel development. The division of labor between the teams can be done easily. One can develop a view, one a model, and the other a controller, and they can progress quickly. It is developed 3 times faster than applications developed with other design patterns.

There can be multiple views using the same model. Any changes can be integrated into the application very easily.

The whole model is not affected by the changes. The interface is frequently updated according to the feedback and deficiencies from the users, so the view needs to be changed. This change to the View does not affect the model. It also supports SEO friendly web application development.

--

--

imtisal

Computer Engineer, Java, Spring Boot, React, Microservices