为什么MVC如此受欢迎? [英] Why is MVC so popular?

查看:191
本文介绍了为什么MVC如此受欢迎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我本来打算让这个较长的问题,但我觉得我使其越短越好,你就会明白我的意思。

I was originally going to make this a longer question, but I feel like the shorter I make it, the better you'll understand what I mean.


  • 的MVC架构模式有3个依赖。视图取决于模型。该控制器依赖于视图和模型。该模型是独立的。

  • The MVC architectural pattern has 3 dependencies. The View depends on the model. The Controller depends on the View and Model. The Model is independent.

层建筑模式定义N - 1的依赖关系,其中N是层数

The Layers architectural pattern defines N - 1 dependencies, where N is the number of Layers.

由于三层:模型,视图和控制器,只有2依赖性,而不是3传统的MVC。其结构是这样的:

Given three Layers: Model, View, and Controller, there are only 2 dependencies, as opposed to 3 with traditional MVC. The structure looks like this:

View ---> Controller ---> Model

[查看取决于控制器,控制器要看产品型号]

[View depends on Controller, Controller depends on Model]

在我看来,这种风格完成同样的目标的的产生更松散的耦合。为什么不是这种风格更常见?是否真正做到同样的目标是什么?

It seems to me that this style accomplishes the same goals and produces looser coupling. Why isn't this style more common? Does it truly accomplish the same goals?

编辑:不会ASP.NET MVC,只是模式

Not ASP.NET MVC, just the pattern.

关于griegs的帖子:


  • 至于嘲讽,图层仍然允许您使用命令处理器模式来模拟按钮点击,以及其他一系列活动。

  • UI变化还是很容易的,也许更容易。在MVC中,控制器和视图倾向于网格在一起。图层创建一个严格分离。两层都是黑盒子,免费实施独立变化。

  • 控制器对观0依赖性。该视图可写,和时间仍然可以松耦合保存。

推荐答案

我没有在很长一段时间得到回本,主要是因为我当时还在想。我不满意我收到的答案,他们并没有真正回答我的问题。

I haven't gotten back to this in a long time, mostly because I was still thinking. I was unsatisfied with the answers I received, they didn't really answer my question.

有一个教授,最近,也引导我在正确的方向。从本质上讲,他告诉我:哪个单独的模型,视图层和控制器的 MVC。在香草MVC架构模式,观对模型之间的相关性往往不使用,你有效地图层结束。我们的想法是一样的,命名仅仅是可怜的。

A professor, recently, did steer me in the right direction. Essentially, he told me this: Layers which separate Model, View, and Controller is MVC. In the vanilla MVC architectural pattern, the dependency between the View to the Model is often not used, and you effectively end up with Layers. The idea is the same, the naming is just poor.

这篇关于为什么MVC如此受欢迎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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