82

观察者模式-zero-51CTO博客

 6 years ago
source link: http://blog.51cto.com/zero01/2066623
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
观察者模式又称为发布-订阅(Publish/Subscribe)模式,是23种设计模式之一。DP中是这么定义观察者模式的:观察者模式定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象。这个主题对象在状态发生变化时,会通知所有的观察者对象,使它们能够自动更新自己。举个生活中的例子,例如在某班级里,几个同学都在某个网站上订阅了一本连载的漫画。当漫画更新时,就会通知这几位同学,同学收到通

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK