CSC/ECE 517 Fall 2012/ch2b 2w37 ms: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(Created page with "<big>''' Adapter pattern and the related patterns (Bridge, Decorator, Facade)'''</big><br> The adapter design pattern allows the user to make changes to the existing class with ...")
 
No edit summary
Line 4: Line 4:


=== Adapter Pattern ===
=== Adapter Pattern ===
Adapter pattern plays an important role when you want to incompatible interfaces to work together.The real world example for an adapter pattern is the travel power adapter.Different countries have different socket and plug configuration. So you can use an adapter to fit a plug into a socket that initially was not possible due to different interface designs.
==== Implementattion ====
===== Adapter implementation using inheritance =====
===== Adapter implementation using composition =====

Revision as of 03:05, 17 November 2012

Adapter pattern and the related patterns (Bridge, Decorator, Facade)

The adapter design pattern allows the user to make changes to the existing class with other class libraries without changing the code for the existing class. The Bridge, Decorator and the Facade pattern look somewhat similar to the adapter pattern but their intent is different and that intent is what separates the above patterns from each other.

Adapter Pattern

Adapter pattern plays an important role when you want to incompatible interfaces to work together.The real world example for an adapter pattern is the travel power adapter.Different countries have different socket and plug configuration. So you can use an adapter to fit a plug into a socket that initially was not possible due to different interface designs.

Implementattion

Adapter implementation using inheritance
Adapter implementation using composition