CSC/ECE 517 Fall 2009/wiki1b 13 pz: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
'''Controller''' is the mean for the user to control the application. The controller acts as the input to the application, it changes the model and select the view as the user requests.
'''Controller''' is the mean for the user to control the application. The controller acts as the input to the application, it changes the model and select the view as the user requests.


[[Image:Mvc1.JPG|thumb|upright=2|The relationship between Model, View and Controller]]
[[Image:Mvc1.JPG|thumb|120x60px|The relationship between Model, View and Controller]]

Revision as of 21:47, 19 September 2009

Model–View–Controller (MVC) is an architecture pattern to separate the business logic of an application from the Graphical User Interface (GUI), so we could modify either of the two without affecting the other one. And programs with MVC is highly maintainable, which could save a lot of work in the future usage, though it may be time-consuming when first coded.

History

MVC was invented at Xerox Parc in the 70's, first introduced in a paper “A Cookbook for Using the Model-View-Controller User Interface Paradigm in Smalltalk -80”, by Glenn Krasner and Stephen Pope, published in the August/September 1988 issue of the Journal Of Object Oriented Programming (JOOP). Due to its big advantage of better organization and code reusability, it’s getting more and more popular. Nowadays, MVC is used on ruby on rails, ASP.NET, Sun’s J2EE platform, ColdFusion and PHP developers etc.

Headline text

Introduction to MVC

Model–view–controller(MVC)obviously is consist of three parts: model, view and controller. Each of them is somehow independent from each other; meanwhile they have some kind of connections with each other.

Model is the main logic domain of an application, storing data and defining means of how to change and process the data. The state of model can be access under the request by view, and can be change by the controller. One model could have multiple views and controllers.

View presents the state of model and data to the outer world, and could be changed by the controller. View could access the data of model freely; however, it could not change the model. The view should change when the corresponding model changes.

Controller is the mean for the user to control the application. The controller acts as the input to the application, it changes the model and select the view as the user requests.

The relationship between Model, View and Controller