Friday, September 4, 2009

Patterns - 022: Structural patterns


  • Deal with objects delegating responsibilities to other objects. This results in a layered architecture of components with low degree of coupling.
  • Facilitate interobject communication when one object is not accessible to the other by normal means or when an object is not usable because of its incompatible interface.
  • Provide ways to structure an aggregate object so that it is created in full and to reclaim system resources in a timely manner.

Pattern Name Description

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.

Façade

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.

No comments:

Post a Comment