Adapter Pattern - Verständnis

I

IsaakTaylor

Hallo,

wollte kurz nachfragen ob ich das Adapter Pattern richtig verstanden
habe. Es scheint mir irgendwie so einfach zu sein.

Also, wenn man zwei inkompatibele Klassen hat. Da die Klient Klasse
eine bestimmte Methoden-Signatur (besser Interface) verlangt und diese
eine andere Klasse X nicht erfüllt.
Also erstellt man eine Adapter Klasse A, die Klasse X ist ein Agregat
der Adapterklasse. Dort könnte sowas stehen

Adapter
{
PersonValidator personValidator;
...

public bool GetName(Person person)
{
return personValidator.ValdiateData(person.Name,
person.Surname...);
}
...
}

also im einfachsten fall nur ein Methodenaufruf. Das wäre der
Objektadapter (da Aggregat). Klassenadapter wäre wenn die klasse X
vererbt und dann deren Methoden überladen würden. Stimmt das so?
 
A

Arved Sandstrom

Arne Vajhøj said:
Try in English.

Arne

Well, the German was pretty understandable, actually. He understands the
Object Adaptor pattern well enough; I assume his reference to "Agregat"
means that there is an instance of his class X wrapped by an instance of the
adapter class A.

As to his (brief) description of the Class Adaptor, based on my best guess
of the meaning of "vererben" in software, his description is incomplete. The
adapter A (in C# or Java) would inherit from X, but also implement the
interface that the client expects.

AHS
 
A

Arved Sandstrom

Arne said:
Not with my German - it is worse than my Cobol.

Arne

Mine's not great, not anymore. I've been meaning to brush up, but...

I was going on the (not unreasonable) assumption that he reads English
better than he speaks/writes it, just as I (more or less) understood what
he wrote, but wouldn't normally attempt to respond in German.

People will get more responses if they write in English, no doubt, but the
problem is that if their English is not so hot, they may understand
something well but express it badly, and a whole thread of confusion
result. As it is I think we're all too quick to jump on folks for bad
spelling or grammar in various NGs without knowing what their native
language is.

AHS
 
A

Arne Vajhøj

Arved said:
As it is I think we're all too quick to jump on folks for bad
spelling or grammar in various NGs without knowing what their native
language is.

I can agree on that one.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top