Learn something new every day
More Info... by email
Model-view-controller (MVC) is a type of software architecture and design pattern that segments each element of a program into well-defined areas of functionality. In model-view-controller architecture, the model deals with all the internal program logic that manipulates, saves, retrieves and otherwise handles and calculates data. The view aspect is responsible for displaying information from the model for the user, and it also provides a way for the user to give input to the program. The controller takes input from the view, assesses or otherwise processes it and interacts with the model to change data or the program state, which ultimately is shown to the user through the view. Although the model-viewer-controller design calls for a program to encapsulate functionality, the three sections still need to interact with one another in some way and generally are dependent on one another in some sense, unlike other more aggressive design patterns.
Quite often, the model-view-controller pattern is seen in applications that manage a graphical user interface (GUI). Using the MVC pattern, the different visual elements of the GUI are handled by the view, the recording and processing of where and what a user clicks is handled by the controller, and actually changing information or loading information is done by the model. Depending on the exact design of an application, each component of the MVC pattern can have a mechanism to interact with the other components, such as the model being able to directly instruct the view to refresh the screen or the view having a way to tell the controller that it is refreshing the screen and not to accept new input. Unlike some design patterns that take a strict black-box approach, model-view-controller programs tend to be slightly more flexible, although some implementations can make an MVC program difficult to change or debug modularly.
In certain instances, the model-view-controller pattern does not have to contain only one of each component. One example is an application that has multiple views, such as multiple monitors, or a display that can be seen on several client devices. Multiple views and controllers can be used in an application that allows many users to access a database, all answering to a single model. It is more common, however, to design systems that maintain a one-to-one ratio of the model-view-controller components.
Even though model-view-controller components have a reliance on one another, it can be much easier to modify certain parts of a system that use the MVC pattern than if no pattern were used at all, especially in the case of non-object oriented applications. If an application uses callbacks or listeners and observers to implement interactions between the components, then each component can be changed without affecting the other two. This means a new GUI could be implemented without affecting the model or controller. It should be noted, however, that fundamental changes to a model-view-controller system might require some small amount of re-coding for each individual component.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!