图1显示了观察者模式的机制。
访问者模式是一种处理任意数据结构的简单技术。
The visitor pattern is a simple technique to process arbitrary data structures.
这里是一个实现了观察者模式逻辑的trait。
Here is a trait that implements the logic of the Observer Pattern.
它可以很简单,如Twitter的扁平跟随者模式。
我使用的模式是直接、间接、外部提供者和外部消费者模式。
The patterns I use are the direct, Indirect, External Provider, and External Consumer patterns.
回调其实是观察者模式[g OF 1995]的一个特例。
Callbacks are really a special case of the Observer Pattern [GOF1995].
问题在于,我们能否在不使用递归的前提下实现访问者模式?
The question is, can we implement the Visitor pattern without recursion?
就访问者模式而言,本文未加详述的另一各方面就是迭代顺序。
Another aspect of the Visitor pattern not closely examined here is iteration order.
无论使用哪种语言,访问者模式都是操作树形数据的一种可靠工具。
In each case, I've found that the Visitor pattern is a reliable tool for manipulating trees of data.
因此,从一个较高的层次上,观察者模式提供了一种简单的异步模型。
Thus, at a high level, the Observer pattern provides a simple asynchronous model.
因此,在Jam 中,访问者模式不能和mixin 一起使用。
Thus, in Jam, the visitor pattern can't be used with mixins.
外部消费者模式允许提供者控制领域外的第三方访问提供者提供的服务。
The External Consumer patterns allows third parties outside the provider governance domain access to services that the provider serves.
不过,观察者模式与单个事件源关联,而反应器模式则与多个事件源关联。
The Observer pattern is associated with a single source of events, however, whereas the Reactor pattern is associated with multiple sources of events.
在基本Web服务结构之上采用观察者模式,就为DEBA带来了回调能力。
It is the Observer pattern on top of the base web services infrastructure that gives DEBA its callback capability.
你是个敏感的人;当你被误解或未被赏识,情绪过度时,你很容易进入受害者模式。
You're a sensitive person; and when you feel overwhelmed, misunderstood or unappreciated, you easily fall into victim mode. Wa, wa, wa.
访问者模式往往用于将数据结构(本例中是树)与通过数据结构操作的算法分离开来。
The Visitor pattern is often used to separate a data structure (the tree, in this case) from the algorithms that operate over the data structure.
访问者模式将创建一个场景,简化对现有数据类型集合添加操作(新访问者)的过程。
The Visitor pattern creates a scenario where adding operations (new visitors) over the set of existing data types is easy.
请考虑访问者模式,其中用for方法为复合层次结构中的每个类都定义了访问者类。
Consider the visitor pattern in which a visitor class is defined with a for method for each class in a composite hierarchy.
第一种模式被称为用户-生产者模式,第二种是联合制作模式,在这之间还的许多模式。
The first model is called the user-producer model and the second the co-production model, with many models in between.
这将作为一种有用的基本用例,类似于经典访问者模式中的基本 Visitor类。
This serves as a useful base case, similar to a base Visitor class in the classic Visitor pattern.
除了简单使用对象和方法,正式的Jo对象使用了重构过的“观察者模式”OOP标准。
Aside from simple utility objects and methods, formal objects within Jo use a refined "observer pattern" OOP standard.
Swing框架以事件侦听器的形式广泛利用了观察者模式(也称为发布-订阅模式)。
The Swing framework makes extensive use of the Observer pattern (also known as the publish-subscribe pattern) in the form of event listeners.
外部提供者模式演示如何将一项非关键业务功能外包给访问一个或多个第三方服务的消费者。
The External Provider pattern demonstrates how to outsource a noncritical business function to a consumer accessing one or more third-party services.
将DEBA应用到Web服务中可以获得两方面的好处,包括Web服务的解藕特性和观察者模式的异步特性。
DEBA for web services benefits from the decoupled nature of web services and the asynchronous nature of the Observer pattern.
这篇文章仅仅是涉及了在访问者模式中使用zippers的一些浅显问题;目的在于激发您进一步探索的兴趣。
This article has just scratched the surface of using zippers in the Visitor pattern; the point of it is to whet your appetite for further exploration.
表1中三个方面的对照,分别为观察者模式、标准Web服务模型,以及在DEBA框架类中观察者模型的实现。
Table 1 shows the correspondence between the Observer pattern, the standard web services model, and the Observer pattern's implementation in the DEBA framework classes.
然而,通过访问者添加新数据类型(类)较为困难,因为访问者模式要求所有具体类型都具有一个visit方法。
Adding new data types (classes) with visitors is difficult, however, as the visitor pattern requires a visit method for all concrete types.
利用Clojure的函数式编程工具来实现访问者模式是消除这种附带的复杂性的一种方法,而且仍然是在JVM上编程。
Leveraging Clojure's functional programming tools to implement the Visitor pattern is one way to get around this incidental complexity, while still programming on the JVM.
如果alter操作是一个in - place alter,或者被修改复制表的参与者模式被设为只读,那么重放位置不会移动。
If the alter operation is an in-place alter, or if the participant mode is set to read-only for the replicated table being altered, the replay position is not moved.
如果alter操作是一个in - place alter,或者被修改复制表的参与者模式被设为只读,那么重放位置不会移动。
If the alter operation is an in-place alter, or if the participant mode is set to read-only for the replicated table being altered, the replay position is not moved.
应用推荐