473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

The adapter design patter

Hello Experts!

I'm reading about design patter in the GAMMA book and there is something
that I don't understand.
That's why I ask you.
It says "Pluggable adpters. A class is more reusable when minimize the
assumption other classes must make to use it. By building interface
adaptation into a class, you eliminate the assumption that other classes see
the same interface. Put another way, interface adaptation lets us
incorporate our class into existing systems that might expect different
interfaces to the class."

Now the first row says "A class is more reusable when minimize the
assumption other classes must make to use it." I can't see why a class
should have any assumption about a class before being able to use it.

Now the second row what does this mean "By building interface adaptation
into a class, you eliminate the assumption that other classes see the same
interface."

Many thanks

//Tony
Sep 2 '05 #1
1 1281
Tony Johansson wrote:
I'm reading about design patter in the GAMMA book and there is something
that I don't understand.
That's why I ask you.
It says "Pluggable adpters. A class is more reusable when minimize the
assumption other classes must make to use it. By building interface
adaptation into a class, you eliminate the assumption that other classes see
the same interface. Put another way, interface adaptation lets us
incorporate our class into existing systems that might expect different
interfaces to the class."

Now the first row says "A class is more reusable when minimize the
assumption other classes must make to use it." I can't see why a class
should have any assumption about a class before being able to use it.

Now the second row what does this mean "By building interface adaptation
into a class, you eliminate the assumption that other classes see the same
interface."


Is there a C++ _language_ question here? Have you already visited the
'comp.object' newsgroup as I suggested or are you still waiting for some
sign from the heavens?

Every assumption you have to make about a class introduces a limitation
or several on the class, thus reducing the re-usability of the class.

When you design a type, you lay the foundation by introducing some
concepts, some assumptions, about the type and about the ways objects of
that type are going to be used. For example, when designing a _list_ you
assume that people will (a) add to the list, (b) remove from the list, and
(c) iterate over the list. Now, (a) and (b) are vague, so let's make the
assumptions that you should be able to insert at any point in the list and
remove any element from the list.

To use the list (or any other class pretending to be a list), you have to
make those assumptions above. And any class that "is-a" list (does not
necessarily mean it inherits from some 'class list') has to implement that
interface.

More in comp.object.

V
Sep 2 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tony Johansson | last post by:
Hello Experts! I'm reading about design patter in the GAMMA book and there is something that I don't understand. That's why I ask you. It says "Pluggable adpters. A class is more reusable when...
7
by: farseer | last post by:
Here is the scenario: I have an interface which defines get methods for data that will make up a row in a table. However, the source of this data may, over time, switch/change (The company may...
0
by: shailaja | last post by:
Hi, I am new to vb.net. I have created a web application in which I have dragged and dropped the Customers table on the aspx design page. Hence I have an adapter for the Customers table which...
6
by: Daniel Santa Cruz | last post by:
Hello all, I've been trying to go over my OO Patterns book, and I decided to try to implement them in Python this time around. I figured this would help me learn the language better. Well,...
1
by: Bruce HS | last post by:
I'm using VS2005, VB, WinForms I’ve developed forms using those nice wizards Microsoft provides. However, I’m running into a couple of complications trying to work with the resulting Table...
3
by: FluffyCat | last post by:
Last month I continued my series of design patterns examples using PHP 5 with the Observer Pattern and the Prototype Pattern. Here now is my 16th example, the Adapter pattern. ...
2
by: FluffyCat | last post by:
In June I continued my series of design patterns examples using PHP 5 with the Adapter Pattern. Here now is my 17th design pattern example, the Bridge Pattern. ...
8
by: =?Utf-8?B?eWRibg==?= | last post by:
I need to write a program validate a text file in CSV format. So I will have a class DataType and a lot of of derived class for various type, e.g. IntType, StringType, FloatType, MoneyType,...
2
by: oliharvey | last post by:
Hi - (not really a C# question -...apologies) I seem to have gravitated towards a particlar design pattern - and would welcome your opinions as to it's sanity - thanks... The basic idea is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.