View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Spring 04 Midterm 2 Review: Design Patterns

a. Factory Method and Abstract Factory design patterns are quite similar. How are they similar and how are they different?

They each are potential solutions to the same set of problems: Allowing one to program to an interface and letting someone else decide which implementing class to use.

The Factory Method design pattern uses context or user input to deside which class fits the kind of thing you are trying to model. The interface is the same no matter which class the Factory Method chooses. The Abstract Factory design pattern uses the same sort of information as the Factory Method to create a factory for groups of related objects.



b. How are the Adapter and Bridge patterns similar and different?

Both of these patterns are used to separate implementation details from interface details.

Adapter is more often used to solve the specific problem of being unable to conveniently alter classes. Adapters act as a front-end to another class. This is often done so that the Adapter can either provide a simpler interface to the class, or only provide the features of the class needed by the client.

Bridge is often more of a behind-the-scenes design pattern. It is used when their is an interface that is expected to run similarly on many different implementations. Bridge has an interface which contains an interface implementation. This implementation can have many subclasses.

The primary differences between these two can be summarized as such: The Adapter design pattern is used as an interface to hide an implementation, and Bridge is used as an interface to hide multiple different implementations.


Andrew Sayman


Link to this Page