MVC的最佳定义是什么? [英] What is the best definition of MVC?
问题描述
更新:我承诺我们都知道BASIC定义(一个模型一个控制器和一个视图,控制器上的操作转到查看一些信息后与模型做某事)但我很想知道什么是你认为每个人都知道的定义,为什么它是错误的(也许这将解释给每个人谁可能会有错误,意见,当然什么是您的真实观点)
请参阅Martin Fowler的企业应用程序架构模式第14章。
MVC部分以:
模型视图控制器)是
中最引用(最多的是错误引用的)
模式之一,它作为一个
框架开始,由Trygve
Reenskaug为Smalltalk平台
从那时起,它已经有
在大多数UI
框架中扮演了有影响力的角色rks和关于
UI设计的想法。
它还说:
我想到的MVC我看到两个
主分离:将
表示与模型分开,
将控制器与
视图。
...
在这些分开的
演示文稿和模型是
软件中
最重要的设计原则之一,唯一的时候你
不应该遵循它是非常简单的
系统,其中模型没有真正的
行为在它无论如何。一旦你
得到一些非视觉逻辑,你应该
应用分离。不幸的是,一个
的很多UI框架使得
变得困难,而那些不是
的人经常被教导没有分离。
视图和控制器
的分离不太重要,所以我只有
建议在真的
有帮助时执行。对于富客户端系统,
最终几乎不存在,虽然
在Web前端通常是
控制器被分离出来。大多数
的网页设计模式是基于这个原则的
。
I have been using Zend Framework in a MVC configuration, read about ruby on rails and plan de check other MVC frameworks in Python(Django?)... i really like the way it isolates some parts of the logic, security and validation. But after just 1 year using it i read an answer here saying almost everyone have wrong definition of MVC and that made me wonder... What is the Right definition of MVC and where could i read about the pattern and standard implementations?
Update: I undertand we all know the BASIC definition (theres a model a controller and a view, the actions on the controller go to the view with some info after making something with the model) but i would love to know what is the definition you THINK everyone KNOWS and why is it wrong( and maybe that will explain to everyone where there could be mistakes, opinions and of course what is your real point of view of this)
See Chapter 14 of the book: Patterns of Enterprise Application Architecture, by Martin Fowler.
The section on MVC starts with:
"Model View Controller (MVC) is one of the most quoted (and most misquoted) patterns around. It started as a framework developed by Trygve Reenskaug for the Smalltalk platform in the late 1970s. Since then it has played an influential role in most UI frameworks and in the thinking about UI design."
It also says:
"As I think about MVC I see two principal separations: separating the presentation from the model and separating the controller from the view.
...
Of these the separation of presentation and model is one of the most important design principles in software, and the only time you shouldn't follow it is in very simple systems where the model has no real behavior in it anyway. As soon as you get some nonvisual logic you should apply the separation. Unfortunately, a lot of UI frameworks make it difficult, and those that don't are often taught without a separation.
The separation of view and controller is less important, so I'd only recommend doing it when it is really helpful. For rich-client systems, that ends up being hardly ever, although it's common in Web front ends where the controller is separated out. Most of the patterns on Web design here are based on that principle."
这篇关于MVC的最佳定义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!