MVC has existed since the end of the 70’s and it has been very beneficial to many people. However, sometimes people do not know what the Model-View-Controller pattern really means. Moreover, the meaning is not necessarily always the same. We will look at the origins of MVC to get a better understanding of it.
What is MVC?
MVC is a pattern that was first used with graphical user interfaces (GUIs). Now, it is also used for most web applications, web frameworks, mobile apps and desktop programs. Most popular programming languages have this pattern too. The goal of MVC is to facilitate development by splitting it into different sections.
Those sections are Model, View and Controller. The Model reflects real-life objects. It usually handles the data and also defines main components of the application or program. The View concerns all the functions with which users interact directly. It defines how users see and interact with the application. Finally, the Controller is the middleman. It communicates with both Model and View and is basically the brains of the application.
Origins of MVC
MVC was invented by Trygve Reenskaug, a Norwegian computer scientist, in the 70s. Its first public appearance is believed to be in Smalltalk group at Xerox Palo Alto Research Center. By the way, Smalltalk is an object-oriented, dynamically-typed, reflective programming language. Reenskaug then published a paper on MVC, although he called it Thing Model View Editor then. Still, he soon renamed it Model View Controller. You can read the original paper here.
The group was working on DynaBook, which was an early conception on what is now known as a tablet pc. It was supposed to be a learning computer for children. So, Reenskaug created MVC to put usability first but not with compromising the function. People believe that it was the first time when software constructs were described and implemented in terms of their responsibilities.
Another significant paper on MVC was published in 1988 by Glenn Krasner and Stephen Pope in Journal of Object Oriented Programming. Its name was „A Cookbook for Using the Model-View-Controller User Interface Paradigm in Smalltalk-80“.
Is there only one MVC model?
Actually, they can be a bit different? First, let’s see how Reenskaug originally defined the functions of Model, View and Controller:
- Model represents knowledge. It can be a single object or a structure of objects.
- View is a visual representation of its models. It’s attached to its model or a model part and gets the date from the model.
- Controller is the link between a user and a system. Controller provides the user with input because it arranges for relevant views to present themselves in appropriate places to the user on the screen.
And the first MVC model, often called Model 1, looks like this:
Meanwhile, there is also MVC Model 2. It is often called the web-based version and was introduced with JavaServer Pages. Usually, people have in mind exactly this model when they talk about MVC concerning web applications. The main difference from Model 1 is that the there is no relationship between Model and View. Everything passes through the Controller, which controls the flow of a user’s request. This model was better for more complex web applications with different teams working on it. This is a simple representation of the model:
You can also watch this video. It can help understand MVC Model 2 better.
Hopefully, you now know a bit more about the origins of MVC. MVC continues to change and evolve. So, people try to correct its faults for more efficiency. Read what is wrong with MVC and how to improve the model.
Leave A Comment