CSC/ECE 517 Fall 2012/ch1 1w20 pp

From Expertiza_Wiki
Revision as of 21:48, 14 September 2012 by Pmpereir (talk | contribs) (→‎References)
Jump to navigation Jump to search

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.

History

The invention of MVC is attributed to Trygve Reenskaug, who was working at Xerox PARC at the time. The 80s decade saw the first implementations of the MVC framework in the form of smalltalks-80. MVC, which was a key feature of the language (Smalltalk) was designed for desktop applications with the main concern being the separation of the presentation from the domain model.

MVC pattern in web application development

Web frameworks using MVC pattern

Advantages and disadvantages of MVC pattern

Advantages

Disadvantages

Examples

References

<references/> 1. http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html

2. http://en.wikipedia.org/wiki/Web_application_framework

3. http://en.wikipedia.org/wiki/Model-view-controller

4. http://rubyonrails.org/

5. http://www.typo3-media.com/blog/mvc-mvp-typo3-introduction.html

6. http://jakarta.apache.org/struts/index.html