Mvc, mvp, mvvm...
-
Upload
yury-kisliak -
Category
Technology
-
view
1.585 -
download
7
Transcript of Mvc, mvp, mvvm...
MVC, MVP, MMVM, ...
Or how I stopped worrying and learned to separate logic and representation
Motivation?
The MVC separation helps you manage complex applications, because you can focus on one aspect a time. For example, you can focus on the view without depending on the business logic. It also makes it easier to test an application.
Model
View
Controller
calls
updates
notifies
The Model is the part of the application that handles the logic for the application data.Often model objects retrieve data (and store data) from a database.
The View is the parts of the application that handles the display of the data.Most often the views are created from the model data.
The Controller is the part of the application that handles user interaction.Typically controllers read data from a view, control user input, and send input data to the model.
● The view objects in an application are actually a composite ● A controller object implements the strategy for one or more
view objects● A model object keeps interested objects in an application—
usually view objects—advised of changes in its state.
Classical MVC
Model–view–adapter (MVA) or
mediating-controller MVCor...
MVP?
Behavior of the active model
Behavior of the passive model
● View is more loosely coupled to the model. The presenter is responsible for binding the model to the view.
● Easier to unit test because interaction with the view is through an interface
● Usually view to presenter map one to one. Complex views may have multi presenters.
MVP
● Controller are based on behaviors and can be shared across views
● Can be responsible for determining which view to display
MVC
Presentation Model aka MVVM... is all about binding (WPF, silverlight, flex, javaFX)
http://developer.apple.com/library/mac/#documentation/General/Conceptual/CocoaEncyclopedia/Model-View-Controller/Model-View-Controller.html
Sources:
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
http://msdn.microsoft.com/en-us/library/ff649643.aspx
http://stackoverflow.com/questions/2056/what-are-mvp-and-mvc-and-what-is-the-difference
http://alexander.lds.lg.ua/2010/05/mvvm-model-view-view-model-design-pattern-for-net-windows-forms-winforms/
MVC in Java world
MODEL 1(not bro)
MVC MODEL 2(bro)
http://www.javaranch.com/journal/200603/Journal200603.jsp#a5
The request processing workflow in Spring Web MVC (high level)
http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/mvc.html