我想知道观察者模式和MVC之间有什么区别。我有在学校用Java编写MVC程序的经验,但没有观察员模式的经验。(有人告诉我,观察者模式意味着我在Java中使用了观察者类.我不认为这是个好答案。)
请帮我回答以下几个问题,谢谢。
- First version is that, MVC is an architecture and Observer Pattern is an design pattern. They look similar because MVC uses the observer pattern.
- Second version is that, observer pattern and MVC is two different design patterns.
发布于 2013-03-22 05:17:04
我希望这也能回答你另外两个问题。
观察者设计模式是一种行为模式,当我们希望在对象x发生变化时通知对象的所有依赖方(例如x)时,就会使用它。好读:http://www.dofactory.com/Patterns/PatternObserver.aspx。
它们都是密切相关的,就像MVC从MVC图中可以看到的那样--例如:必须将“View”中的更改通知给“Model”和“Controller”--实现这一功能的一个有效方法是观察者设计模式。
读得好:pattern
In fact the observer pattern was first implemented in Smalltalk's MVC based user
interface framework.希望这能有所帮助!

发布于 2013-03-22 05:07:28
有很多文章与你所问的问题有关。MVC对我来说是一种架构模式,它“包含”观察者模式。我相信,如果一个人真的研究MVC模式在不同的现实项目的实现,其中有不止一个设计模式。
要么放大,要么放大。
https://stackoverflow.com/questions/15563005
复制相似问题