Model-View-Controller |
This topic introduces the MVC design architecture. |
|
The Model-View-Controller (MVC) is an architectural design pattern that defines separate functional components for a program. It is based on the functional division of a program by data store, presentation, and execution logic.
The MVC design components are defined as follows:
- Model: manages the data store and responds to inputs from the View and Controller components based on the business logic; seldom changes
- View: comprises the user interface layout and presentation details; may change frequently
- Controller: manages and synchronizes model and view
The execution of a web application seldom changes as it is based on the business logic. In a typical web application, even a minute change in the user interface may bring about changes in its business logic, making it necessary to retest the application.
Using the MVC design pattern, you can divide an application program into standalone components with minimal interdependency. Such a division ensures that changes in a component has minimal impact on the other components, and enables the individual testing of each component. It is especially useful for web applications, where the user interface of a page may change frequently, as compared to the data store and execution logic.
Web applications based on MVC are also easier to customize for multiple devices such as mobiles, palm tops, and desktop computers, as the customization requires changes in the View component only. Thus, the development effort for the MVC components can also be divided based on specialized skill sets.
It is also possible to base different Views on the same Model so that a common set of data is used in multiple pages of a web application.