was invented by one Smalltalk programmer, Trygve Reenskaug. Trygve maintains a page that explains the history of MVC. in his own words. He arrives at these definitions in a paper he published on December 10th, 1979: 1. Models Models represent knowledge. A model could be a single object (rather uninteresting), or it could be some structure of objects. 2. Views A view is a (visual) representation of its model. It would ordinarily highlight certain attributes of the model and suppress others. It is thus acting as a presentation filter. 3. Controllers A controller is the link between a user and the system. It provides the user with input by arranging for relevant views to present themselves in appropriate places on the screen.
it's an incredibly common pattern. It is literally all around you. In fact, let me bring it back down to Earth this way: you're looking at MVC right now. Model = HTML View= CSS Controller= Browser
HTML is the "skeleton" of bedrock content. Text that communicates information to the reader. 2. View The CSS adds visual style to the content. It is the "skin" that we use to flesh out our skeleton and give it a particular look. We can swap in different skins via CSS without altering the original content in any way. They are relatively, but not completely, independent. 3. Controller The browser is responsible for combining and rendering the CSS and HTML into a set of final, manipulatible pixels on the screen. It gathers input from the user and marshals it to any JavaScript code necessary for the page to function. But here, too, we have flexibility: we can plug in a different brower and get comparable results. Some browsers might render it faster, or with more fidelity, or with more bells and whistles.
manipulate state, typically in a database of some kind. 2. View The user interface bits (in this case, HTML) necessary to render the model to the user. 3. Controller The brains of the application. The controller decides what the user's input was, how the model needs to change as a result of that input, and which resulting view should be used.
for responding to user input, often making changes to the model in response to user input. In this way, controllers in the MVC pattern are concerned with the flow of the application, working with data coming in, and providing data going out to the relevant view.
stored in static fi les on disk. As dynamic web pages gained prominence, web servers served HTML generated on the fly from dynamic scripts that were also located on disk. With MVC, it’s a little different. The URL tells the routing mechanism which controller class to instantiate and which action method to call, and supplies the required arguments to that method. The controller’s method then decides which view to use, and that view then renders the HTML.