MVP VS MVC设计模式网页和移动设备? [英] MVP vs MVC design patterns for web and mobile?

查看:204
本文介绍了MVP VS MVC设计模式网页和移动设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关即将开展的项目,我期待到MVP作为在MVC的选项。我非常熟悉和喜欢MVC,和我只是想看看我是否会使用MVP获得任何东西。

For an upcoming project, I am looking into MVP as an option over MVC. I am highly familiar with and like MVC, and am merely trying to see if I will gain anything using MVP.

我收集关于MVP的是,它使用ASP.Net视图引擎/ MVC#(我特别不喜欢),使用ViewState的 - 加入一些额外的内容呈现的网页,而不是建路由功能(可以写成分别进入在Global.asax)

What I gather about MVP is that it uses the ASP.Net view engine/MVC# (which I don't particularly like) that uses the ViewState - adding a bunch of extra content to a rendered web page, and not built in routing functionality (can be written in separately into the Global.asax).

在另一方面MVC /剃须刀,呈现非常干净的HTML。

MVC/Razor on the other hand, renders very clean HTML.

的某些制品,例如这一个似乎偏向使用MVP的多个视图,但在使用jQuery Mobile MVC3的光,有可以与此MVC。

Certain articles, such as this one seem to lean towards using MVP for multiple views, however in light of MVC3 with jQuery Mobile, there are some fantastic things that can be accomplished with this MVC.

如何做这些比较什么是目前可用的MVP?有哪些优点/缺点或使用过MVP MVC?

How do these compare to what is currently available with MVP? What are some pros/cons or potential pitfalls of using MVP over MVC?

我也在考虑使用现有的应用程序MVP加快开发时间。

I am also considering using an existing MVP application to expedite development time.

我知道你将会在以下畏缩,而是寻找选项:
虽然这个应用程序提供所有需要的功能,如果实施这一解决方案,难的是如何在更多的MVC应用(我知道这看起来很难看),以配合?如果这是东西,我们不得不考虑的问题(两者相结合),那会是最好的包装在MVC(路由)的应用和具有MVP的应用程序里面所含?

I know you will cringe at the following, but looking for options: While this app offers all the required features, if implementing this solution, how difficult is it to tie in additional MVC applications (I know that looks ugly)? If this was something that we had to consider (combining both), would it be best to wrap the application in MVC (routing) and have the MVP app contained inside?

这样做的原因是交错的功能更新方法,其中,所述的要求是实现一个新的功能(这是使用MVC架构建立;该系统的其余部分则不是)。未来的计划是在目前框架完全更改为MVC或MVP。

The reason for this is a staggered feature update process, where the requirement is to implement a new feature (which is built using the MVC framework; the rest of the system is not). Future plans are to completely change the current framework to either MVC or MVP.

感谢。

推荐答案

您似乎是混乱的图案与这里的框架。

You seem to be confusing patterns with frameworks here.

这两个MVC和MVP的设计模式,MVC ASP.net和MVC#,另一方面是实现了MVC / MVP的设计模式框架。

Both MVC and MVP are design patterns, ASP.net MVC and MVC# on the other hand are frameworks that implement the MVC/MVP design patterns.

有是一个巨大的混乱和冲突的很多关于MVC和MVP模式和逸岸Martin Fowler的谁赞成2新发MVP受欢迎,因为退休的格局的家伙之间的差异在网络上的信息。请参见这里

There is a massive confusion and lots of conflicting information on the web about the difference between MVC and MVP patterns and infact Martin Fowler the guy who made MVP popular since "retired" the pattern in favour of 2 new ones. See here

这两种模式是有帮助的这是肯定的关注点分离,但除此之外没有真正地不是很多他们之间的差异,我发现的唯一的事情就是MVC有屏幕,作为每个部件控制器MVP是但如果你有一个复杂的画面,甚至违反这条规则每屏之一。我仍然不确定,并使用术语互换自己。

Both patterns are there to aid separation of concerns that is for sure, but other than that there really isnt a lot of difference between them, the only thing I have found is that MVC has a controller per widget on the screen where as MVP is one per screen although even this rule is violated if you have a complex screen. I am still unsure and use the terms interchangeably myself.

有一件事我看到遍地是,在MVP的看法是负责创建presenter,然而,这是不是原来设计的一部分。这似乎已经从一个事实,即旧的Web框架,如asp.net web表单页面均出现中心。你没有改变这种方式,所以它是创造了presenter的页面(视图)。基本的框架越来越在模式的方式,因此一个黑客是鞋作出喇叭了。很不幸,这似乎已经成为描述MVP的事实上的方法。

The one thing I see over and over is that in MVP the view is responsible for creating the presenter, however this is not part of the original design. It appears to have arisen from the fact that older web frameworks such as asp.net webforms were page centric. You had no way of changing this and so it was the page (view) that created the presenter. Basically the framework is getting in the way of the pattern and so a hack was made to shoe horn it in. Unfortunately this seems to have become the defacto way of describing MVP.

基本上我上面的文字是想说,如果你想要做的MVC正确使用设计做了一个框架,ASP.net MVC是一个不错的选择墙,它是MS栈,很好的支持的一部分(MVC自2008年以来#处理不当被更新),如果你已经喜欢它的生产力努力学习别的东西心不是真的值得失去它IMO

Basically my wall of text above is trying to say that if you want to do MVC properly use a framework designed to do it, ASP.net MVC is a good choice, it is part of the MS stack, well supported (MVC# hasnt been updated since 2008) and if you are already happy with it the loss of productivity trying to learn something else isnt really worth it imo

这篇关于MVP VS MVC设计模式网页和移动设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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