MVC

From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Introduction[edit]

Graphical process of MVC

The Model-view-Controller, or MVC, is a popular way to organize code for apps and websites that have some sort of user-interface. The idea is that some pieces of code can be grouped into different objects that serve different functions. By using this method, it makes it much easier for fellow collaborators to understand the purpose of the authors code, and where future material should be added. These three objects are Model, View, and Controllers.

History[edit]

Trygve Reenskaug, the orginial creator of the MVC

Model View Controller was originally created by Trygve Reenskaug, a Norwegian Computer Scientist, who first implemented it in Smalltalk-79 while he was visiting the Xerox Palo Alto Research Center in the 1970s. He wrote his first paper on MVC in 1978, originally calling it the Thing Model View Editor pattern. MVC would later be implemented in Smalltalk-80 by Jim Althoff and others in the 1980s. The MVC pattern would evolve into multiple variants, these being hierarchical model–view–controller (HMVC), model–view–adapter (MVA), model–view–presenter (MVP), model–view–viewmodel (MVVM), as well as many other adaptations to the pattern. It grew in popularity and usage in 1996 due to the introduction of NeXT's WebObjects.

Components[edit]

-The browser is you

-The controller is the head which takes the http request and turns it into a execution parameter which contains the data the user requested it then sends the data to the model .It then takes the resulting data array back from the Model and passes it on to the View and after it finishes it takes the GUI content and gives a HTTP response to the Browser to display to the user. the controller ‘controls’ the model and view by managing the flow of data at every step to allow for a seamless flow.

-The model is like a large storage for all the data the controller then sends an execution request to the model which takes that request, finds the data that is necessary and passes it to the view.

-The view will then take all the data and organize it neatly into the format of the website based on the code to this part is critical since if the data is not properly loaded and organized it wont make sense to the end user(you). So to prevent it from looking like a mess we need a view For example the warehouse for gatorade would be like the model, the store shelf would be the view and the warehould manager would be the controller. Wherever you go to the store and before you see the gatorade shield a request was sent to the warehouse manager(the controller) for more gatorade which he then sent to the warehouse(the model) to collect the bottles from the massive storage. They are then sent to the store(the view) who organizes it on the shelf categorically and neatly for the custom(the browser) to see and find the information(gatorade) they want. This would be how a Model view controller works.

Usage[edit]

It is commonly used to design web applications and mobile apps and across many frameworks like Python, Ruby, PHP, and JavaScript. MVC can be found used in actual apps and web applications that have a user interface like clash royale, facebook, instagram,etc.

References[edit]