CSC/ECE 517 Fall 2012/ch1 1w20 pp
Introduction
A common feature of today’s web applications is to retrieve data from a data store and display it for the user. The system stores the updates in the data store when the user changes the data. The flow of information between the data store and the user interface might compel the computer programmer to tie these two pieces together to reduce the amount of coding. This approach has significant problems. User interface logic tends to change more frequently than business logic, especially in Web-based applications. If user interface code and business logic are combined in a single object, you have to modify an object containing business logic every time you change the user interface. Also, in most cases, the application displays the same data in different ways. Tight coupling between the presentation and business logic would mean that the same code is repeated at multiple places. This reduces the maintainability and flexibility of the application.
The Model-View-Controller (MVC) pattern separates the modeling of the business logic, the presentation, and the actions based on user input into three separate classes:
Model: The model manages the behavior and data of the application domain. It responds to requests for the user interface(view), and responds to instructions from the controller to change state.
View: The view refers to the user interface and manages the display of information
Controller: The controller interprets the inputs from the user, informing the model and/or the view to change appropriately.