视图不与模型交互时是MVC吗? [英] Is it MVC when the view doesn't interact with the model?

查看:69
本文介绍了视图不与模型交互时是MVC吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计了一个MVC(在.NET中),其中View没有链接到模型.它只知道控制器.传统的MVC模式具有相互通信的所有部分.就我而言,Controller基本上是中介者.这样可以将任何异常或逻辑排除在视图之外.它对模型的依赖性为零.这不再是MVC吗?

I've designed an MVC (in .NET) where the View has no link to the Model. It only knows about the Controller. The traditional MVC pattern has all parts communicating with each other. In my case, the Controller is basically a mediator. This keeps any exceptions or logic out of the View. It has zero dependency on the Model. Is this no longer an MVC?

推荐答案

您所描述的实际上是模型视图控制器的子集,称为

What you are describing is actually a subset of Model-View-Controller called Passive View.

被动视图是另一种变化 在模型视图控制器上 模型视图演示者.和这些一样 用户界面在一个视图之间 处理显示和一个控制器 响应用户手势. 被动视图带来了重大变化 是视图是完全做成的 被动,不再负责 用于从模型中更新自身. 结果所有视图逻辑都在 控制器.结果,有 在任何方向上都没有依赖性 在视图和模型之间.

Passive View is yet another variation on model-view-controller and model-view-presenter. As with these the UI is split between a view that handles display and a controller that responds to user gestures. The significant change with Passive View is that the view is made completely passive and is no longer responsible for updating itself from the model. As a result all of the view logic is in the controller. As a result, there is no dependencies in either direction between the view and the model.

马丁·福勒

Martin Fowler talks about it in the above link and briefly discusses other variations here.

这篇关于视图不与模型交互时是MVC吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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