Re: What design pattern should I use to wrap a 3rd party data access DLL?



On Dec 9, 10:32 am, "H. S. Lahman" <h.lah...@xxxxxxxxxxx> wrote:
Responding to ethanliu...

   I have to use 3rd party DLL to access their data through http, I
use this DLL to pull a stream from them and  have to reference the
types defined in the DLL to parse the stream. The problem is to
decouple my application that use the data from the part that access
and parse the data.

   What design pattern is the most appropriate one for this? Thank you
for your help!

The Facade pattern is usually used in this situation. Essentially it
provides a wrapper interface that is designed around your application's
data needs and that interface invokes whatever API the DLL provides in
the Facade object's implementation.

--
Life is the only flaw in an otherwise perfect nonexistence
    -- Schopenhauer

H. S. Lahman
H.lah...@xxxxxxxxxxx

I agree that facade patter will be the overall wrapper.
But before the facade pattern can be implemented, an adapter needs to
be created to plugin the the third party DLL and a factory can be used
to parse the data and convert into the structure that the host system
understands. So, Builder can call the adapter which inturn calls the
DLL.. Then builder can pass the data for parsing and transforming to
the host structures. Then a facade can be used to orchestrate the
task

Thanks,
Kalyan Lanka
.



Relevant Pages