Monday 2 April 2007

Lecture 27.02.07 (B) - Critiquing one of the GOF Design Pattern, Adapter Pattern

In this lecture we all were introduced to the 23 GoF Catalogue Patterns. Brief knowledge was obtained and I am taking the ADAPTER PATTERN a little futher by critizing the 11 elements in this catalog pattern.

Name
Adapter pattern makes one interface match to another. It acts as a plug in.

Intent
Converts the interface of a class into another interface a cliets expects.

Also Known Uses
Its also known as Wrapper.

Motivation
This section elaborates about how existing and unrelated classes come into one application and from there on how there are made compatiable to work on a same interface. It also emphasises on a problematic area and from there on it vastly builds into addressing those issues by introducing different approaches. Besides that, having a diagrammatic viw in adapter pattern illusrates the fullfilling of responsibility of each class.

Applicability
In this section it clearly states where and when it should be used to adopt the interface.

Structure
This element overlaps with the MOTIVATION element because this class adapter uses multiple inheritance concept to adpt one interface to another and this information can be incorporated into MOTIVATION element as mentioned in the begining.

Participants
The advantage here ist that it clearly devides the domain interface use by the client, works together with objects conforming the target interface, defines the interface need ofadpating, and adapting the target interface. In short it can briefly demontrates and identify the obtainability of relationship.

Collaborations
In this section, the association here emphasises on the UML diagrams.

Consequenses
Information such as the do's and don'ts, characteristics of the adapter pattern, rules of the adapter pattern. In short, this element provides all the principles of adapter pattern when come to implementing them.

Implementation
Here the implementation is applied on C++ to display hierarchical structure. Three(3) types of implementation approach is used and they are abstract approach, usage of delegate objects and parameterized adapters. All this three approaches are used together which is much easier to be introduced rather than implementing them separately using TREE display.

Sample Code
In my opinion, sample code element need not be given great emphasise as it can be illustrated in any language. Creating the source code can be time consuming and lenghty process.

Known Uses
This pattern has been used on the following systems: InterViews 2.6 defines an Interactor abstract class and a Graphic abstract class. Both have graphical appearances but they have different interfaces and implementations (they share no common parent) [1]

----------------------------------------------------------------------------------------------------------------
Reference Link:http://www.vico.org/pages/PatronsDisseny/Pattern%20Adapter%20Object/index.html [1]









1 comment:

John Ssebaale said...

Hi I did some critising of the GOF catalog elements. I seemed to have taken a different view on critiquing it. Check out my blog in case you have time

Cheers