GofPatterns Gofpatterns  





Structural Patterns  «Prev  Next»
Lesson 4Common structural patterns
ObjectiveList the common Structural Patterns

Gof - Structural - Patterns
There are seven popular structural design patterns which you are liable to encounter. In this module, we are going to concentrate on the Flyweight pattern, and incorporate it into the course project. The other six common structural patterns are described in the SlideShow below:


Pictorial View of Structure Patterns.


Decorator: Extends the functionality of an object in a manner that is transparent to its clients without using inheritance.
Adapter: Allows the conversion of the interface of a class to another interface that clients expect. This allows classes with incompatible interfaces to work together.
Chain of Responsibility: Avoids coupling a (request) sender object to a receiver object. Allows a sender object to pass its request along a chain of objects without knowing which object will actually handle the request.
Facade: Provides a higher-level interface to a subsystem of classes, making the subsystem easier to use.
Proxy: Allows a separate object to be used as a substitute to provide controlled access to an object that is not accessible by normal means.
Bridge: Allows the separation of an abstract interface from its implementation. This eliminates the dependency between the two, allowing them to be modified independently.
Virtual Proxy Facilitates: The mechanism for delaying the creation of an object until it is actually needed in a manner that is transparent to its client objects.
Counting Proxy: When there is a need to perform supplemental operations such as logging and counting before or after a method call on an object, recommends encapsulating the supplemental functionality into a separate object.
Aggregate Enforcer: Recommends that when an aggregate object is instantiated, all of its member variables representing the set of constituting objects must also be initialized. In other words, whenever an aggregate object is instantiated it must be constructed in full.
Explicit Object Release: Recommends that when an object goes out of scope, all of the system resources tied up with that object must be released in a timely manner.
Object: Cache Stores the results of a method call on an object in a repository. When client objects invoke the same method, instead of accessing the actual object, results are returned to the client object from the repository. This is done mainly to achieve a faster response time.
These patterns use the same basic techniques to form their structures, so they look somewhat similar on the face of it. Howwever, most of these patterns solve different problems, and in general the problem you face determines which pattern you choose.
Common Structural Patterns - Quiz
Here is a short quiz on the material we have just covered.
Common Structural Patterns - Quiz