We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Software

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What Is Model-View-Controller?

By Eugene P.
Updated: May 17, 2024
Views: 6,413
Share

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.

Share
WiseGeek is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.

Editors' Picks

Discussion Comments
Share
https://www.wisegeek.net/what-is-model-view-controller.htm
Copy this link
WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.

WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.