Web 上的 MVC 模式与桌面上的 MVC 模式有什么区别?
在阅读了一些模型视图控制器模式之后,似乎该模式在 Web 框架与桌面框架中的实现方式有很大不同。使用基于 Web 的 MVC 框架,视图和模型永远不会直接通信。他们只能与控制器通信。但在桌面实现中,视图和模型似乎可以直接通信,这对我来说没有意义。这似乎违背了 MVC 拥有独立、干净、隔离层的目的。另外,如果视图和模型直接通信,控制器会做什么?
这是来自 Wikipedia 的图表,说明了 MVC 。
After doing some reading on the Model View Controller pattern it seems that the pattern is implemented quite differently in web frameworks vs desktop frameworks. With web based MVC frameworks the view and model never communicate directly. They can only communicate with the controller. But in desktop implementations, it seems that the view and model can communicate directly which doesn't make sense to me. That would seem to defeat the purpose of MVC of having separate, clean, isolated layers. Plus, what does the controller do if the view and model communicate directly?
Here is a diagram from Wikipedia illustrating MVC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我发现这篇文章似乎最能解释这个问题。 http://andrzejonsoftware.blogspot.com/2011/09/rails -is-not-mvc.html
看来确实有两种同名的架构:MVC 和 Model2。
I found this article that seems to best explain the issue. http://andrzejonsoftware.blogspot.com/2011/09/rails-is-not-mvc.html
It appears that there are really two architectures going by the same name: MVC and Model2.
有趣的是,我最近在博客上写了一篇关于 MVC 概念在 Web 框架中的不同实现的文章。
您可以在此处阅读。
It's a funny thing that I wrote recently an article on my blog about the different implementation of the MVC concept in web frameworks.
You can read it here.
还有 Presentation-abstraction-control
also there is Presentation-abstraction-control