When solving distributed problem , one can strictly focus on the
interaction between class
Object and class
Algo,
while forgetting about how other protocols are implemented. In particular,
all protocols needed to support protocol
are transparently used
through inherited services of class
Object. Those services
might also be implemented applying the Strategy pattern, but this is
transparently managed by inherited operations of
Object. In that
sense, BAST uses the Strategy pattern in a powerful recursive
manner.
The recursive use of the Strategy pattern is illustrated in
Figure 4. The latter schematically presents a possible
implementation of protocol class CSSObject presented in
Section 3.1, which enables to solve the distributed consensus
problem by providing operations propose() and decide(). On
this Figure, the gray oval is context class CSSObject, while inner
white circles are various Algo strategy classes (
being
different protocols). Arrows show the connections between provided
services (top) and required services (bottom) of each strategy class.
Operations provided by class CSSObject are grouped on the application
layer side (top). Each strategy class pictured in
Figure 4 is managed by the corresponding context class in
the protocol class hierarchy presented in Figure 1 (b).
Figure 4: Recursive use of the Strategy pattern