Understanding Adapter Pattern Using .NET
page 11 of 15
by David Simmonds
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 54287/ 175

Advanced Issues

Useful Variations

1a        Symmetrical adapters

None of the classes that the client is interested in looks like the target.  They all need to be adapted to look like what we need them to look like.  The speedometer situation is like that since all existing cars (which I know of) translate wheel-turn rates into ground-speed.  However, at some point, the inevitable interventions of big-brother will manifest itself in the use of GPS for speed-measurement (and of course speed-tracking and automatic ticketing).  In this case we will not need the use of an adapter since GPS measures actual distance traveled and not “wheel-turn-rates.”  

1b        Asymmetrical adapters

Some adaptees have the desired interface and so do not need adaptation.  Some adaptees however, need adaptation in order to integrate with the main system, whether from legacy systems or systems newly acquired.

2a        Distributed adapter/Wide adapter

Adapts several methods within the adaptee into several distinct methods which the target interface will utilize.

2b        Solitary adapters

Adapts 1 method in the adaptee to 1 required method in the target.

3a        Extrinsic/Forward adapter

Sucks data out of the adaptee for use in the target.

3b        Intrinsic/Reverse adapter

Passes data from the target to the adaptee in order to update itself.

4ai       Conversion adapter

Converts a single result or value from the adaptee into the equivalent value for use by the target. Similar to Imperial-measurement to Metric-measurement converters or foreign currency converters or wheel-revolutions to distance covered converters (odometer).

4aii      Translating adapter

These adapters perform language and jargon translations, measurement-converters and also currency-rate converters typify the behavior of these adapters.

4b        Amalgamated adapters

Amalgamates several parameters coming out of the adaptee to a single unified value going to the client (such as speedometer converting wheel-turn-numbers and rates into a single speed).

5a      Pre-adaptation

Adapts the adaptee to the target preemptively.  Most pattern-authors do not recognize this as a legitimate form of adapter.  They argue that adapter allows variation in classes after-the-fact in contrast to bridge’s accomodation of variation before-the-fact.

5b      Post-adaptation

The ideal target already exists and the adapter converts subsequent interfaces of adaptees which do not meet the target-interface into that interface.  This is the widely recognized variation.

If you look closely you will realize that pre/post adaptation has bearing on the concept of symmetrical/asymmetrical adaptation.  Arguably, if we know before hand how the interface needs to look but do not have the technology to create that interface, then we will symmetrically do pre-adaptation of all existing systems to the interface which we will target in the future.  That is just one example of a combination of the concepts.


View Entire Article

User Comments

Title: its great explaination in detail about Adapter Pattern   
Name: Elan Emerging Technologies Pvt. Ltd
Date: 2010-01-18 7:05:35 AM
Comment:
its great explaination in detail about Adapter Pattern


Thanks,
Elan Emerging Technologies (EETPL)
http://www.elantechnologies.com
Title: Thanks   
Name: Rakesh
Date: 2008-12-08 2:59:28 PM
Comment:
Looking forward to read this article
Title: Very Understandable   
Name: Srilakshmi15
Date: 2008-05-11 7:19:36 AM
Comment:
Hi Simmonds
It's really good to understand without getting any confusion.
Thanks a lot.
Title: Not able to Download the Codes   
Name: Ritesh
Date: 2007-08-07 4:19:25 AM
Comment:
I am not able to download the codes of the above sample
Title: Great! Resouces.   
Name: .Net Developer
Date: 2007-05-14 1:56:04 AM
Comment:
It's Great Resouces for abt adapter pattern. I hope you will writing usefull .net articles in future.

Jim
http://www.tatvasoft.com
Title: its great explaination in detail abt adapter pattern   
Name: vamshi
Date: 2006-11-14 5:27:20 AM
Comment:
its great explaination in detail abt adapter pattern with a clear explanation -not found any where else. hope i will get other pattern too
Title: Adapter Explanation with real Time   
Name: Ranjith M
Date: 2006-11-03 4:03:56 AM
Comment:
Its realy cool.I went through lot of links i dont understand the pattern.The real time explanation is realy good one.Thanks a Lot.:)

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-12-08 10:50:55 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search