MVC->MVP->MVVM(未完)
2010-08-26 23:46
239 查看
WPF 引入了MVVM模式。
本来就对MVC没有过多了解,这下晕了。
MVC至少还听得多,MVC和MVVM Pattern究竟区别何在?为何MS在推出MVC之后,又推出MVP,再推出现在的MVVM.
????
这个问题得好好想想。
----------------------------------------------------
Compare with MVC &&MVP
http://www.codeproject.com/KB/aspnet/AspNetMvcMvp.aspx
http://www.codeproject.com/KB/architecture/MVC_MVP_MVVM_design.aspx (推荐)
Sometimes you can hear: MVP is similar to MVC.
Then I have to say, yes, but as similar as is the C# similar to Java. You can read Java code very quickly. But if you’ll be sit to the PC with ‘
First of all we need to correctly ‘localize’ the words in both abbreviations. Look at this two triplets:
Model ViewController
Model ViewPresenter
For this article we will prefer
本来就对MVC没有过多了解,这下晕了。
MVC至少还听得多,MVC和MVVM Pattern究竟区别何在?为何MS在推出MVC之后,又推出MVP,再推出现在的MVVM.
????
这个问题得好好想想。
----------------------------------------------------
Compare with MVC &&MVP
http://www.codeproject.com/KB/aspnet/AspNetMvcMvp.aspx
http://www.codeproject.com/KB/architecture/MVC_MVP_MVVM_design.aspx (推荐)
Sometimes you can hear: MVP is similar to MVC.
Then I have to say, yes, but as similar as is the C# similar to Java. You can read Java code very quickly. But if you’ll be sit to the PC with ‘
Eclipse’ instead of
Visual Studio, how long will take you to produce ‘Hello World’ application?
First of all we need to correctly ‘localize’ the words in both abbreviations. Look at this two triplets:
Model ViewController
Model ViewPresenter
For this article we will prefer
MVCsyntax and adjust
MVP.
The first homophone word is Model.
MVC: Model == Plain container for storing references.
Modelhas properties (ValueType, Objects even Collections) but does NOT have methods. This is great advantage of the Model, because whatever information you will need on
View, put it in the
Model- May be not so obvious but that's so wonderful place for
AOPextending...
MVP: Model == Business. Model is not model as in MVC. It in fact represents the Business Facades or Services (or whatever you named it) which allows you to access objects (Entities, DataTables). This
Model,bussiness mainly contains methods! Add(), Remove(), Update() ….
The second homophone word is View.
MVC: View == Viewrepresents
UI(user interface).
Viewtakes care for nice layout, smart controls, images, hyper-links. All that stuff is built from information stored in the model.
Viewexposes
Controller's
Actions via 'buttons' and 'links'. When they are clicked –
MVCdirectly creates
Controllerand calls its
Action– and the
Viewitself is lost in the past.
MVP: View == Exposes some properties to its presenter, and as presenter executes all needed calls to the
Model(Bussiness), assembles itself (
View) by filling its exposed properties. The user’s requests are handled by
Views methods. In these methods the Presenter is asked to communicate with Model and refill Exposed properties.
The third words are finally different not only by meaning but even by name
MVC: Controller == User requests are primarily routed to the Controller’s Actions. Viewat this moment only gathers the user inputs, which are transferred into Model. Controller then calls Business to ‘Get’, ‘Update’, ‘Delete’ etc. and refills the Model. Next the Viewrenders the Model’s content.
MVP: Presenter == Viewcreates and asks presenter to get or set data from Model-Business. After Presenter fills all exposed View’s properties, the execution continues on Viewside.
相关文章推荐
- Android产品研发(二十五)-->MVC/MVVM/MVP简单理解
- Android产品研发(二十五)-->MVC/MVVM/MVP简单理解
- [0] MVC&MVP&MVVM差异点
- [1] MVC & MVP &MVVM
- android MVC && MVP && MVVM分析和对比
- 设计模式 --> MVC,MVP 和 MVVM 的图示
- android MVC && MVP && MVVM分析和对比
- 前端MVC&MVP&MVVM
- android MVC && MVP && MVVM分析和对比
- 从三层架构到MVC,MVP <转载>
- 开发模式总结:MVC、MVP&MVVM
- Android产品研发(二十五)-->MVC/MVVM/MVP简单理解
- 架 c0b3 构模式:MVC,MVP&MVVM
- Spring MVC学习-----------<mvc:annotation-driven /> 到底做了什么工作
- 展示模式架构比较MVP(SC),MVP(PV),PM,MVVM和MVC
- 前端框架模式MVC、MVVM和MVP的讲解
- 浅谈Android开发中的MVVM模式及与MVP和MVC的区别
- MVC,MVP 和 MVVM 的图示区别
- iOS-【转载】架构模式 - 简述 MVC, MVP, MVVM 和 VIPER
- MVC MVP 和 MVVM 的图示