Is MVC a Design Pattern or Architectural pattern

2019-01-30 01:12发布

According to Sun and Msdn it is a design pattern.

According to Wikipedia it is an architectural pattern

In comparison to design patterns, architectural patterns are larger in scale. (Wikipedia - Architectural pattern)

Or it is an architectural pattern that also has a design pattern ?

Which one is true ?

10条回答
我只想做你的唯一
2楼-- · 2019-01-30 01:38

If you put ten software architects into a room and have them discuss what the Model-View-Controller pattern is, you will end up with twelve different opinions. … Some of the purists out there will inevitably have qualms with what I refer to as “MVC”. Feel free to leave a flaming comment on the message board at the bottom of this Web page. I will gladly entertain different perspectives on what MVC means, but keep in mind that I do not care.

Josh Smith

查看更多
太酷不给撩
3楼-- · 2019-01-30 01:38

MVC is architecture pattern. Very clearly stated and shown at http://molecularsciences.org/zend/mvc_model_view_controller

查看更多
Animai°情兽
4楼-- · 2019-01-30 01:40

And according to Martin Fowler they are GUI architectures: Martin Fowler-GUI architectures

It depends on the size of the application, as it only affects GUI related classes, in a small one (mostly GUI) it could be considered an architectural pattern whereas in a huge one it would just be a design pattern that you apply to the GUI code (could be 10% of the apps code).

查看更多
地球回转人心会变
5楼-- · 2019-01-30 01:40

I think both are true. If you're looking at a particular instantiation of MVC in a framework like Ruby on Rails, that instantiation is more of a design pattern. If you look at MVC as a general concept, it's more of an architectural pattern.

查看更多
时光不老,我们不散
6楼-- · 2019-01-30 01:45

MVC is more of an architectural pattern, but not for complete application. MVC mostly relates to the UI / interaction layer of an application. You're still going to need business logic layer, maybe some service layer and data access layer. That is, if you're into n-tier approach.

查看更多
Rolldiameter
7楼-- · 2019-01-30 01:56

I know that it's been answered awhile ago, but no one has yet mentioned the book that made MVC famous: Pattern-Oriented Software Architecture (POSA), by Buschmann, et al published in 1996. Though not as widely read as the Design Patterns book, by Gamma, et al, POSA is one of the foundational books used by the patterns community.

Oh, and POSA very clearly identifies MVC as an architectural pattern. My hunch is that MS and Sun are just being sloppy and calling every pattern a "design pattern".

查看更多
登录 后发表回答