MVP MVC和MVVM之间的区别 [英] difference between MVP MVC and MVVM

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

问题描述

伙计我已经经过许多环节/博客了。我看大多数人无法在深入浅出清晰沟通,以及MVP,MVVM和MVC之间的技术差异。我知道每一个字符代表和还参与了MVP。但不真正了解,如果有人问我同样的问题。为什么不能在我使用的MVP,而不是控制presenter的?而为什么视图模型在MVVM,而不是presenter,它是如何区别?我可以在一个单一的sentense说:MVC是ASP.NET优化,也有在VS模板,MVP为WinForms和MVVM关于SL / WPF优化,因为它支持内置的绑定功能等。但我觉得它不是我有什么理解,但在细节和深沉。难道在这有人扔光了详细解释和用法与实际理由选择之一。谢谢大家...

Folks I have gone through many links/blogs. I see most of them not able to clearly communicate in layman language and as well technical difference between MVP, MVVM and MVC. I know what every character stands for and also worked on MVP. But dont really understand if someone asks me the same question. Why cant I use controller in MvP instead of Presenter ? And why View Model in MVVM instead of presenter and how does it differs ? I can in a single sentense say"MVC is optimized for ASP.NET and also has templates in VS, MVP is optimized for winforms and MVVM for SL/WPF as it supports inbuilt binding features etc". But I feel that its not what I have to understand, but in detail and deep. Could some one throw light on this with detailed explanation and usage and actual reason to choose one. Thank you all...

推荐答案

我不能给你一个完整的答案,但是我做了斗争,以了解其中的一些模式,可能可以给你一些的想法主要差异。

I can't give you a complete answer, however I did struggle to learn some of these patterns and might be able to give you an idea about some of the main differences.

我学到MVVM,然后再MVC。我知道MVP以及它是如何工作的理论,但是我从来没有真正构建的应用程序吧。

I learned MVVM first, and then MVC. I am aware of MVP and how it works in theory, however I have never actually built an application with it.

在设计模式的最大区别似乎是谁控制应用程序流程和逻辑。

The biggest difference between the design patterns seems to be who controls the application flow and logic.

MVVM ,您的code类(的ViewModels )的应用程序,而你的查看仅仅是pretty友好的用户界面,它位于应用程序code的顶部,并允许用户与它进行交互。这意味着的ViewModels 有一个庞大的工作,因为他们的的应用程序,并负责一切从应用程序流的业务逻辑。

In MVVM, your code classes (ViewModels) are your application, while your Views are just a pretty user-friendly interface that sits on top of the application code and allows users to interact with it. This means the ViewModels have a huge job, because they are your application, and are responsible for everything from application flow to business logic.

MVC ,您查看是您的应用程序,而你的控制器处理应用流。应用程序逻辑在的ViewModels 通常发现,这被认为是 M 在MVC(旁注的一部分: M MVC中不能被视为等同于 M 在MVVM因为MVC的 M 层包含了比MVVM的 M 层更多的功能)。用户被赋予一个屏幕(查看),它们与之交互然后提交一些东西到控制器控制器决定谁做什么用的数据,并返回一个新的查看给用户。

With MVC, your Views are your application, while your Controller handles application flow. Application logic is typically found in ViewModels, which are considered part of the M in MVC (sidenote: the M in MVC cannot be considered the same as the M in MVVM because MVC's M layer contains more functionality than MVVM's M layer). A user is given a screen (View), they interact with it then submit something to the Controller, and the Controller decides who does what with the data and returns a new View to the user.

我没有使用过的 MVP ,但我对它的理解是非常相似的MVC,但对于桌面应用程序,而不是客户端/服务器应用进行优化。在查看是实际应用,而 presenter 处理应用程序事件和业务逻辑。

I have not used MVP, however my understanding of it was very similar to MVC, but optimized for a desktop application instead of a client/server application. The Views are the actual application, while the Presenter handles application events and business logic.

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

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