Model-View-Controller (MVC)
MVC, which stands for Model-View-Controller, is a software design pattern used in the development of applications, allowing different visualisation methods of data to be presented to a user.
MVC (Model-View-Controller), considered as an Architectural pattern or design pattern, separates the business logic and the user interface of the developed application, both of which have different objectives.
MVC, which holds a significant place in application development, makes development easier by materializing data and separating code in complex applications with millions of data. It can be used in desktop, web, and mobile applications. It can work with object-oriented programming.
Many people confuse the MVC approach with the Asp.Net MVC Framework. However, the MVC approach existed before the Asp.Net MVC Framework. It only gained more popularity with Asp.Net MVC. MVC architecture was first defined in 1979 by Trygve Reenskaug. It was later introduced on the Smalltalk programming language. Today, MVC model is widely used in modern web applications.
MVC Operation Logic
The MVC architecture consists of three parts. These are divided into Model, View, and Controller.
The MVC architecture works as follows: When a request is made to the View page from the browser, the View layer goes to the Controller. The Controller goes to the Model layer to execute the request. Then, the data obtained from the Model is sent to the View, allowing the desired data to be displayed. In its simplest sense, MVC is an effort to divide an application into three areas.
- Model: The layer where the data is stored in the MVC architecture, where access to the database is provided, and where all data operations take place is the model layer. The data is processed here and the queries are made here. On the other hand, it means modeling, i.e., attributing meaning to concrete objects in a computer environment. These can be data, files, or simple objects. For example, when a customer registers on a website, information such as name, age, gender, and location related to them are stored in the model.
- View: View is the visualized state of the Model layer, the state where the user sees the application. Everything the user can see is in the View layer. It includes all UI components such as text boxes, menus. It benefits from interface technologies such as Html, Css, Javascript.
- Controller: It performs operations between the Model and View layers. In other words, it carries all operations such as database operations and calculations received from the View layer to the Model layer. It serves as a bridge in-between.
What Does MCV Do?
The answer to the question "What is MVC?" is a software design model commonly used to develop user interfaces. So, what does MCV do?
- With the MVC model, the readability of the codes in large projects is facilitated. The MVC model allows the code to be updated and added.
- MCV provides the essential components required for designing desktop, web, and mobile applications.
- It prevents different parts of projects like Frontend, Backend and Database from mixing with each other.
- It enables the code to be tested and thus reduces the error rate. The MVC model makes the code more readable by grouping codes with different purposes. All classes and objects are independent of each other.
- Codes written with MVC can be used easily in different projects.
What are the MVC Web Frameworks?
The following are the popular and widely used MVC Frameworks:
- Ruby on Rails
- Django
- CherryPy
- Spring MVC
- Catalyst
- Rails
- Zend Framework
- Fuel PHP
- Laravel
- Symphony