Next: Sample Code
Up: External Polymorphism An Object
Previous: Consequences
The following issues arise when implementing this pattern.
- Arguments to specificRequest. Projecting
polymorphic behavior will usually require adaptation of the
signatures of the various specificRequests. This can be
complicated when, for instance, some require arguments,
whereas others do not. The implementer must decide whether to
expose those arguments in the polymorphic interface or to
insulate the client from them.
- Where does the code go?
As mentioned in Section 6, the external class
hierarchy must be maintained in parallel with the original
classes. The implementer must carefully select the source
files in which co-dependent code, such as signature
adaptation, is implemented.
- External Polymorphism is not an Adapter. The intent of
the Adapter pattern is to convert an interface to
something usable by a client. External Polymorphism, on the
other hand, focuses on providing a new base for existing
interfaces. A ``serendipitous'' use of External Polymorphism
would find all signatures for specificRequest identical
across all disparate classes, and thus not require the use of
SignatureAdapter; it is in this situation where it is
most apparent that External Polymorphism is not an Adapter.
Chris Cleeland
Tue Oct 22 01:20:58 CDT 1996