'. '

MVC

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(Classical MVC)
Line 1: Line 1:
-
[[wikipedia::Model–view–controller]] obsoleted (modernized) by [[DCI]].
+
[[wikipedia::Model–view–controller]] obsoleted (modernized) by [[DCI]]. In spite the [[MVC]] is found in almost every article and many technologies claim to adhere to its principles, there is a lot of confusion about its actual meaning and variations.
 +
Here is my own summary based on an excellent [http://zdrojak.root.cz/clanky/uvod-do-architektury-mvc/ MVC Introduction] article. Thanks for such great write up!
=== Pattern Name ===
=== Pattern Name ===
Line 5: Line 6:
The first thing [[MVC]] stands for is name for a category of patterns that somehow separate the model from the rest. There are many things to do it, each of them suitable for different user interface. Each of such patterns however keeps model independent from the rest - e.g. model does not know anything about its presentation or business logic.
The first thing [[MVC]] stands for is name for a category of patterns that somehow separate the model from the rest. There are many things to do it, each of them suitable for different user interface. Each of such patterns however keeps model independent from the rest - e.g. model does not know anything about its presentation or business logic.
-
Information taken from [http://zdrojak.root.cz/clanky/uvod-do-architektury-mvc/ MVC Introduction] article. Thanks for such great write up!
 
=== Classical [[MVC]] ===
=== Classical [[MVC]] ===
Line 14: Line 14:
The user reads from the view and deals directly with the controller.
The user reads from the view and deals directly with the controller.
 +
 +
=== [[GUI]] in 80ties ===
 +
 +
As time moved on, the separation of printer and card reader got replaced by monitor with attached keyboard and mouse. Although these devices are still independent, they are usually close to each other and are manipulated by a single person simultaneously. To absorb this paradigm change, the [[MVC]] changed as well and resulted in a modified version called [[MVP]]:
 +
 +
[[Image:Mvp.png]]
 +
 +
Here the user deals with the view (like [[GUI]] button or text field) directly. The changes in the view propagate to presenter. Presenter is responsible for applying business logic, validating input data and updating the model. With rise of modern [[GUI]] the [[MVP]] almost completely displaced the original meaning of [[MVC]] and these two become almost synonyms.

Revision as of 15:02, 4 November 2009

wikipedia::Model–view–controller obsoleted (modernized) by DCI. In spite the MVC is found in almost every article and many technologies claim to adhere to its principles, there is a lot of confusion about its actual meaning and variations. Here is my own summary based on an excellent MVC Introduction article. Thanks for such great write up!

Pattern Name

The first thing MVC stands for is name for a category of patterns that somehow separate the model from the rest. There are many things to do it, each of them suitable for different user interface. Each of such patterns however keeps model independent from the rest - e.g. model does not know anything about its presentation or business logic.


Classical MVC

Designed in 70ties. Strictly separates view and controller. The view can for example be a printer, the controller can be a punch card reader and interpreter. Obviously separating these two is easy. Not only they are physically independent, but also the delay between producing of output and receiving input can be significant. The whole idea can be illustrated as:

Image:Mvc.png

The user reads from the view and deals directly with the controller.

GUI in 80ties

As time moved on, the separation of printer and card reader got replaced by monitor with attached keyboard and mouse. Although these devices are still independent, they are usually close to each other and are manipulated by a single person simultaneously. To absorb this paradigm change, the MVC changed as well and resulted in a modified version called MVP:

Image:Mvp.png

Here the user deals with the view (like GUI button or text field) directly. The changes in the view propagate to presenter. Presenter is responsible for applying business logic, validating input data and updating the model. With rise of modern GUI the MVP almost completely displaced the original meaning of MVC and these two become almost synonyms.

Personal tools
buy