498 | Chapter 13: Symmetric Proxy Pattern
Summary
The Symmetrical Proxy design pattern represents the kinds of experiments with
design patterns envisioned by Gamma and his associates when they wroteDesign
Patterns: Elements of Reusable Object-Oriented Software. James Heliotis and Axel
Schreiner’s key insight is that two sides of a game over the Internet can be played on
a client using symmetrical referees and each side pitting a local player against the
proxy of an opponent. This is not an isolated solution to any single game, but rather
any games played over a network.
Our particular implementation of the design pattern used Flash Media Server 2 to
send the moves of each side to the other, and it’s doubtful whether Heliotis or
Schreiner had a clue about FMS2. Therein lies the strength of the design pattern.
Design patterns should represent general solutions to problems and not specific
implementations of a solution. Because of the flexibility of the Symmetrical Proxy
pattern, we were able to apply it using the Internet communication program of our
choosing, rather than one specified by the original designers.
By building in a proxy method into the interface and its implementations in the two
players, we were able to make changes to the general design that did not violate its
flexibility. This “androgynous” feature may have reduced the granularity of the
design and slightly enlarged the size of the main classes, but it remained within both
the structure and the spirit of the design pattern. Design patterns are general solu-
tions, and as long as the patterns meet the key criteria of flexibility and reusability
while maintaining good OOP practices, they can be implemented in an unlimited
number of ways.