Is the MVC-pattern a pure presentation-tier pattern?

拥有回忆 提交于 2019-12-01 15:33:26

问题


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? :)


回答1:


You're wrong... for the class. In class, what teacher/book says goes.

Outside class, I agree with you 100%.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/5091378/is-the-mvc-pattern-a-pure-presentation-tier-pattern

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!