MVC, or model view controller, is a technique used in software. Its fundamental purpose is to build a distinction between the way the software handles data, and the way the software interacts with the user. This distinction means that the processes can be handled, developed and checked separately, which can be more efficient.
The process is based on the concept that, at the simplest level, all software carries out the same three-step function. First a user inputs data, then software processes the data, and finally the software outputs the results as a new set of data. A very basic example of this is a user typing “2+2=” into a calculator, the calculator working out the answer, and then the calculator displaying “4.”
In the MVC system, the way the computer processes the data is known as the model. The output of the results is known as the view. The input of data by the user is known as the controller. It’s important to remember that the view and the controller are the sections of the program which control the input and the output. The terms don’t usually refer to physical objects such as a keyboard or monitor.
The purpose of using MVC is to make it simpler to isolate different elements of a software process. By using the system, a program is effectively divided into three parts: the data processing, the input process and the output process. This means that changes to one part of the program can be made more smoothly without having to also rewrite the other parts of the program.
The model view controller system is widely regarded to have been pioneered in a programming language titled Smalltalk. Created in the 1970s at Xerox, Smalltalk was partially designed to teach people about the object model of computing. Put simply, that involves breaking down a computing task into separate parts and building the program around the way those parts interact. Smalltalk was also an example of dynamic programming, in which a program can be revised even while it is operating.
The MVC system is often used in web-based software such as that used in dynamic, or interactive, websites. In these situations, the view is the code, such as HTML, which is generated by the software after processing a query. For example, on a search engine, the search query box would be the controller and the results page the view.