MVC 模式是纯粹的表示层模式吗?
今天是一个特殊的问题:)
我刚刚在我的技术大学进行了一次测试,结果告诉我我错了。
所以我想从你们那里知道(我比我的老师更相信你们):
MVC 模式仅在表示层实现吗? 或者是业务/数据访问层中实现的模式的模型部分。
我的老师说,一个模式不可能跨越多层。 但我认为这是一种企业架构模式,因此可以跨越多个层。
我有多么错? :)
Kind of a special question today :)
I just had a test at my technical university where I was told that I am wrong.
So I like to know from you folks(I believe you more than my teachers):
Is the MVC-pattern implemented at the presentation-layer only?
Or is the Model-part of the pattern in the Business/DataAccess-layer implemented.
My teacher said, it's not possible that a pattern can span more than one tier.
But I think it's an an enterprise-architecture-pattern and therefore can span multiple tiers.
How wrong am I? :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你错了……对于班级来说。课堂上,老师
/book说什么就说什么。在课外,我100%同意你的观点。
You're wrong... for the class. In class, what teacher
/booksays goes.Outside class, I agree with you 100%.
您的老师是对的,“模型”仅代表要呈现的数据。例如,构成网页的数据。
数据本身最终将来自业务层,但模型应仅限于表示层。这是您的演示文稿的模型。
例如,您可以将数据作为数据集检索,并使用数据集构建特定于页面的模型。
Your teacher is right, the "model" merely represents data that is to be presented. For example, the data that makes up a web page.
The data itself will ultimately come from the business layer, but the model should be restricted to the presentation layer. It's the model of your presentation.
For example, you might retrieve data as datasets, and use the datasets to build page-specific models.
我认为 MVC 确实比表示层更深入,原因很简单,提供模型确实需要其他层做“某事”。
此外,如果我们将模型视为 领域概念(参见 DDD) 的某种表示 -那么我们已经在谈论超越表示层了。
I would think MVC does go deeper than presentation tier for the simple reason that supplying the model does require other tiers to do "something".
Besides if we think of model as some representation of Domain concepts (see DDD) - then we are already talking about going outside of Presentation tier.