Adapter Design Pattern
you have old application which have access of some old component like this.
Now you introduce new component and this new component have new interface. client used to with old interface, so problem started, how to make sure client should not change his call.
Here Adapter pattern come in picture and help you, to make unrelated classes work together.
I have good example for this, when i was doing some application porting from windows to linux.
Window MFC have CFile class, but linux doesn't have this kind of class.
We had introduce a new class CFile and wrapper around C++ fstream object and provided same interface which is there for CFile.
Bingo problem resolved, not required much modification in client code, just added new class header.
www.desikudi.in |