awt and swing components, such as jbutton or jtable, use the observer pattern to decouple the generation of gui events from their semantics within a given application.
awt和swing组件(例如jbutton或jtable)使用观察者模式消除了gui事件生成与它们在指定应用程序中的语义之间的耦合。
the observer pattern defines a one-to-many relationship between objects.
观察者模式在对象之间定义了一种「一对多」的关系。
the reactor pattern is closely related to the observer pattern in this aspect: all dependents are informed when a single subject changes.
反应器模式与观察者模式(observer pattern)在这个方面极为相似:当一个主体发生改变时,所有依属体都得到通知。
callbacks are really a special case of the observer pattern [gof1995].
回调其实是观察者模式[gof1995]的一个特例。
figure 6: behavior in the observer pattern
图6:observer模式中的行为
what is difference between observer pattern and reactive programming?
观察者模式和反应性编程的区别是什么?。
this style is similar to the observer pattern in that it promotes a publish-subscribe way of working.
这个风格与observer模式十分相似,因为它促进一种发布-订阅的工作方式。
the swing framework makes extensive use of the observer pattern (also known as the publish-subscribe pattern) in the form of event listeners.
swing框架以事件侦听器的形式广泛利用了观察者模式(也称为发布-订阅模式)。
figure 6 is a uml sequence diagram showing how the structural elements within the observer pattern collaborate.
图6是一个uml序列图,显示这个observer模式中的结构元素是如何协作的。
thus, at a high level, the observer pattern provides a simple asynchronous model.
因此,从一个较高的层次上,观察者模式提供了一种简单的异步模型。
the observer pattern is associated with a single source of events, however, whereas the reactor pattern is associated with multiple sources of events.
不过,观察者模式与单个事件源关联,而反应器模式则与多个事件源关联。
it is the observer pattern on top of the base web services infrastructure that gives deba its callback capability.
在基本web服务结构之上采用观察者模式,就为deba 带来了回调能力。
a unique use of the observer pattern is to implement it using web services.
观察者的唯一使用之处就是在web服务的实现中。
the observer pattern and web services
观察者模式和web服务
think observer pattern & publish/subscribe rather than api calls.
回想一下观察者和发布/订阅模式,而不是api调用。
the observer pattern defines a one-to-many dependency between objects so that when one changes state, all of its dependents are notified and updated automatically.
观察者模式定义了对象之间的一对多的依赖关系,这样当一个对象的状态发生改变时,依赖它的那些对象将会被通知到,会自动更新自己的状态。
figure 5: structural elements in the observer pattern
图5:observer模式中的结构化元素
the traditional observer pattern specifies two primary actors: a subject and an observer.
传统的观察者模式有两个主要的参与者:一个subject (目标)和一个observer(观察者)。