Sunday, February 19, 2006

 

Software Design Patterns: How much do you understand?

In the three design patterns, the most I understand are structural patterns (especially the adapter and bridge design pattern).

The adapter pattern uses both inheritance and delegation.
For example, when two systems A nad B are totally different and cannot be modified, an adapter is needed. The adapter implements each method declared in A in terms of requests to B.

According to the textbook, the bridge pattern decouples the interface of a class from its implementation. It serves the same purpose as the adapter pattern except that the developer is not constrained by an existing component.
Maybe we use the example above again. This time, a subsystem C is added to B. However, there maybe some changes to C and B doesn't know, a bridge pattern is needed.
It acts as in interface to C and B, implements method to C and B.

Sorry to Steven that I'm not clear of the behavioral and creational patterns.

This page is powered by Blogger. Isn't yours?