CSC/ECE 517 Fall 2012/ch2b 2w47 am: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:


Sometimes, objects just don't fit together as they should. A class may have changed, or an object turns out to be just too difficult to work with. At such times, adapter design pattern comes to the rescue. Adapter pattern lets you adapt what an object or class has to offer so that another object or class can make use of it. It also helps when classes can't work together because of incompatible interfaces.
Sometimes, objects just don't fit together as they should. A class may have changed, or an object turns out to be just too difficult to work with. At such times, adapter design pattern comes to the rescue. Adapter pattern lets you adapt what an object or class has to offer so that another object or class can make use of it. It also helps when classes can't work together because of incompatible interfaces.
Since we are huge fans of visual approach, lets understand the adapter pattern with the help of a diagram. Hold on! Before going in to the UML diagram ( which is kind of lets attractive, right? May be .. ) lets look at the figure below which is more appealing.


[[File:AdapterPatternForWiki.jpg|thumb|500px|center|A real world example for the Adapter Pattern.]]
[[File:AdapterPatternForWiki.jpg|thumb|500px|center|A real world example for the Adapter Pattern.]]
The above example helps readers quickly get across the <b>intent</b> of the pattern than the UML diagram shown below which now, can help the readers to learn the precise relationships between the classes in adapter pattern:
[[File:AdapterPatternUMLForWiki.jpg|thumb|500px|center|UML diagram for the Adapter Pattern.]]

Revision as of 04:55, 18 November 2012

Adapter Pattern, a directory of sites

This wiki page provides a directory of sites for Adapter Design Pattern that will help readers to know what each website contains, why should readers refer one website over another and a list of examples that readers can look up to understand the Adapter Pattern.

Introduction

Sometimes, objects just don't fit together as they should. A class may have changed, or an object turns out to be just too difficult to work with. At such times, adapter design pattern comes to the rescue. Adapter pattern lets you adapt what an object or class has to offer so that another object or class can make use of it. It also helps when classes can't work together because of incompatible interfaces.

Since we are huge fans of visual approach, lets understand the adapter pattern with the help of a diagram. Hold on! Before going in to the UML diagram ( which is kind of lets attractive, right? May be .. ) lets look at the figure below which is more appealing.

A real world example for the Adapter Pattern.

The above example helps readers quickly get across the intent of the pattern than the UML diagram shown below which now, can help the readers to learn the precise relationships between the classes in adapter pattern:

UML diagram for the Adapter Pattern.