Aktuelle Änderungen Printable View Änderungen Bearbeiten
JVM > Java > WhitespaceInPython > ModelViewControllerClear TrailModel-view-controller (MVC) is a software architecture that separates an application's data model, user interface, and control logic into three distinct components so that modifications to one component can be made with minimal impact to the others.
MVC originally came out of Xerox PARC when they were trying to develop 3-D viewers in smalltalk. The Model was the three dimensional scene. The view was the raster image that was presented to the user. The controller moved the virtual camera, sending messages to the view to update itself. It could also send messages to the model to move things around. When they got moved the View was told to update itself. It was then realized that this was a powerful way of thinking about a lot of computer interaction, so the model became the data, the view the rendered image on the screen, printer, etc. and the controller the way the user tells the computer what is wanted.[1]
In the MVC paradigm the user input, the modeling of the external world, and the visual feedback to the user are explicitly separated and handled by three types of object, each specialized for its task. The view manages the graphical and/or textual output to the portion of the bitmapped display that is allocated to its application. The controller interprets the mouse and keyboard inputs from the user, commanding the model and/or the view to change as appropriate. Finally, the model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).
Controllers receive input, usually as events that encode mouse movement, activation of mouse buttons, or keyboard input. Events are translated to service requests for the model or the view. The user interacts with the system solely through controllers. [2]
Document/View is a specialization of MVC, in which the Model is the Document, and the View and the Controller are combined into the View.[3]
MVC is all about a clean break between the data, the logic that occurs around that data when a user interacts with an application, and the presentation of that data to the user. [4]
In a traditional web context, the View and Controller responsibilities are always split between the web server and the client, where View components on the server produce HTML for View components in the browser, and Controller components in the browser produce HTTP requests for Controller components in the server. In a full-blown "web 2.0" system, most of the View and Controller work is done in JavaScript, in the browser, and the server is increasingly acting as a pure Model interface. [5]
In this pattern, "Model" refers to the data-access layer, "View" refers to the part of the system that selects what to display and how to display it, and "Controller" refers to the part of the system that decides which view to use, depending on user input, accessing the model as needed.