MVC的实际应用||何时使用,或不使用MVC [英] Practical Application of MVC || When to use, or not use MVC

查看:81
本文介绍了MVC的实际应用||何时使用,或不使用MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过的ASP.NET社区纷纷议论MVC。我知道它的起源的基础知识,并有许多网站(除非我弄错了,堆栈溢出本身)基于ASP.NET MVC。

I have seen the ASP.NET community buzzing about MVC. I know the basics of its origin, and that there are many sites (unless I am mistaken, stack overflow itself) based on ASP.NET MVC.

这一切,我已经听到和读到关于MVC它似乎是ASP.NET开发的未来。但因为我通常不会在.NET Web开发玩水,我在想以下几点:什么时候适合使用MVC,当它是不是,为什么?伟大的(和可怕的)使用MVC的例子是迷人的。

虽然我知道有MVC的其他实现照片喜欢RoR的我是在为.NET程序员的影响更感兴趣的其他语言。

From everything I have heard and read about MVC it seems to be the future of ASP.NET development. But since I don't usually dabble in .NET web development I am left wondering the following: when is it appropriate to use MVC and when is it not, and why? Examples of great (and terrible) use of MVC would be fascinating.
Though I realize there are other implementations of MVC view other languages like RoR I am more interested on its impact for .NET programmers.

如果这已经走了过来,我的道歉!

If this has already been gone over, my apologies!

推荐答案

下面是我的2对MVC美分Web应用程序。对于那种GUI应用,为这MVC最初的目的,需要监听器​​code,使UI可以在事件改变了模型的数据进行更新。

Here are my 2 cents about MVC for web applications. For the sort of GUI apps for which MVC was originally intended, "listener" code was required, so that the UI could be updated when events altered the model data.

在MVC了这种网络是不必要的,你得到你的听众免费:Web服务器,而HTTP请求是该事件。所以,真正的MVC网页应该是更简单。事实上,它可以归结为调解模式,其中控制器模型和视图之间调解。

In MVC for the web this is unnecessary, you get your listener for free: the web server, and the HTTP request IS the event. So really MVC for the web should be even simpler. Indeed, it could be boiled down to the Mediator pattern, where the Controller mediates between the model and the view.

有两件事情是有很多关于困惑。无论传统的智慧:

There are two things that there is a lot of confusion about. Regardless of conventional "wisdom":

框架!= MVC

数据库数据!=模型

全栈Web开发框架通常会添加大量功能,并可能会或可能不会在其核心MVC导向。的特点之一,很多框架补充的是访问数据库或对象关系映射功能,因为框架和MVC搞混,随后数据库数据和MVC模型方面还感到困惑。该模型可以通常被看作是为应用程序的基础数据,但它不具有来自一个数据库。一个很好的例子可能是一个wiki,其中底层模型/数据由文件修订的数据,例如,从RCS。

"Full stack" web development frameworks typically add lots of features, and may or may not be MVC-oriented at their core. One of the features many frameworks add is database access or object relational mapping functionality, and because frameworks and MVC get confused, subsequently database data and the model facet of MVC also get confused. The model can generally be viewed as the underlying data for the application, but it does NOT have to come from a database. A good example might be a wiki, where the underlying model/data consists of file revision data, for instance, from RCS.

希望这有助于我敢肯定,别人将有大量增加。

Hope this helps and I'm sure others will have plenty to add.

这篇关于MVC的实际应用||何时使用,或不使用MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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