Is the Bridge Pattern the same as Herb Sutter's Pimpl Idiom?

D

Debajit Adhikary

I'm still pretty new to design patterns... I was wondering, is there
any difference between the Bridge Pattern and Herb Sutter's Pimpl
Idiom?

Both delegate responsibility to an implementation and thus allow a
clear and flexible separation of interface and implementation such that
the implementation can be changed freely.
 
D

Daniel T.

Debajit Adhikary said:
I'm still pretty new to design patterns... I was wondering, is there
any difference between the Bridge Pattern and Herb Sutter's Pimpl
Idiom?

Yes. With the Pimpl Idiom the outside class is not an "Abstraction" and
the inside class can only be of one specific type. With the Bridge
pattern, the outside class is a true abstraction that can be implemented
in any of several different ways, while the inner class is *also* an
abstraction that can be implemented in any of several different ways.

The purpose of Pimpl is to break a compilation dependency, the purpose
of Bridge is to allow a Class to be extended in two independent ways.
 

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

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top