Bridge Pattern - Object Adapter

ayushmaan_jain
Mausschubser
Mausschubser
Beiträge: 64
Registriert: 18. Okt 2014 11:11

Bridge Pattern - Object Adapter

Beitrag von ayushmaan_jain »

Hi All,

It is mentioned in slide that Object Adapter has two following advantages :

• Adapter works with Adaptee and any subclass of it.
• Adapter can add functionality to Adaptee and its subclasses.


I could not understand how can adapter add new functionality to adaptee and its and subclasses. Could anyone help me with this ?



Regards,
SJ

FabianG
Erstie
Erstie
Beiträge: 14
Registriert: 22. Okt 2012 00:05

Re: Bridge Pattern - Object Adapter

Beitrag von FabianG »

Hi,
no guarantee for this, but my guess is the purpose of the Adapter is to implement certain methods of the Target by creating a connection between the Target and the Adaptee. The Object Adapter does so by holding a reference to a concrete Adaptee and calling the related methods of it (see the structure of the Object Adapter on slide 6). Instead of simply calling "a.specificRequest()" the Adapter could also do something before and after this call (e.g. add logging or something like that), hence adding functionality to the Adaptee.

Regards

ayushmaan_jain
Mausschubser
Mausschubser
Beiträge: 64
Registriert: 18. Okt 2014 11:11

Re: Bridge Pattern - Object Adapter

Beitrag von ayushmaan_jain »

Thanks for good explanation !

Antworten

Zurück zu „Archiv“