Check out the new USENIX Web site. next up previous
Next: Strategy/Context Interactions. Up: Strategy Pattern in BAST Previous: Inadequacy of Inheritance Alone.

Protocol Algorithms as Strategies

According to Gamma et al., the intent of the Strategy pattern is to ``define a family of algorithms, encapsulate each one, and make them interchangeable'' [5, page 315,]. This is usually achieved by objectifying the algorithm [4], i.e., by encapsulating it into a so-called strategy object; the latter is then used by a so-called context object. Making each tex2html_wrap_inline777 Object protocol class independent of the algorithm supporting protocol tex2html_wrap_inline777 is precisely what we need to be able to compose reliable distributed protocols in a flexible manner.

In the BAST framework, strategy objects represent protocol algorithms and they are instances of subclasses of class ProtoAlgo. A ProtoAlgo subclass that implements an algorithm for solving problem tex2html_wrap_inline777 is referred to as class tex2html_wrap_inline777 Algo. In the Strategy pattern terminology, a protocol algorithm, instance of some tex2html_wrap_inline777 Algo class, is a strategy, and a protocol object, instance of some tex2html_wrap_inline777 Object class, is a context. A strategy and its context are strongly coupled and the application layer only deals with instances of tex2html_wrap_inline777 Object classes, i.e., it knows nothing about strategies.





Benoit GARBINATO
Wed May 14 17:28:46 MET DST 1997