WPF:MVP与MVVM [英] WPF: MVP vs MVVM

查看:86
本文介绍了WPF:MVP与MVVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MVP VS MVVM有什么区别?为什么我们使用MVP,尽管我们有三层:业务,数据访问和表示?将Presentation层划分为MVP是否有任何特定原因?

What is the difference between MVP VS MVVM? Why we are using MVP even though we have three layers: business, data access and presentation? Is there any specific reason to divide the Presentation layer into MVP?

推荐答案

MVP和MVVM都是MVC的派生. MVC是一种将用户表示和交互与内部表示分开的模式.

MVP and MVVM are both derivatives of MVC. MVC is a pattern that separates the user presentation and interaction from the internal representation.

这需要三层,因为将用户交互/表示直接绑定到内部表示会导致两者都弯曲以彼此一致.在您的应用程序中,您将这些层描述为表示层,业务层和数据访问层.仅使用那些非常宽松的描述,您就可以描述任何MVC派生产品或原始MVC模式本身.

This requires three layers, since tying the user interaction/presentation directly to the internal representation will cause both to bend to conform to each other. In your application, you described these layers as the Presentation, the Business layer, and the Data Access layer. With only those very loose descriptions, you could potentially be describing any of the MVC derivatives, or the original MVC pattern itself.

每个导数之间的关键区别是每一层对其他层的依赖性以及它们彼此之间的绑定程度.本文详细介绍了这些区别,但是当然不应该将其视为权威:

The key differences between each of the derivatives are the dependencies each layer takes on the other layers, and how tightly they are bound to each other. This article has some details on the differences, though of course it shouldn't be considered authoritative:

http://nirajrules.wordpress.com /2009/07/18/mvc-vs-mvp-vs-mvvm/

"...... MVVM在支持双向绑定且工作量较小的平台上颇具吸引力.ViewModel也是一个小小的折衷,与Presenter可以独立存在(Presenter通常需要View的界面)不同."

"... MVVM is attractive for platforms which support bi-directional binding with less effort. Also a minor tradeoff is ViewModel unlike Presenter can stand on its own (Presenter normally requires a View’s interface)."

这篇关于WPF:MVP与MVVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆