Can you explain the difference between the Bridge pattern and the Adapter pattern?

The Bridge and Adapter patterns both involve two interfaces working together, but Bridge is a proactive design decision that separates an abstraction from its implementation, while Adapter is a reactive fix that makes an existing incompatible interface work with another.

Key Points: • Bridge is designed upfront to let abstraction and implementation evolve independently. • Adapter is applied after the fact to reconcile interfaces that weren't designed to work together. • Bridge typically involves two parallel class hierarchies connected by composition from the start. • Adapter usually wraps a single existing class to translate its interface into one the client expects. • Bridge is about planned flexibility; Adapter is about integration compatibility.

Example: A Bridge might split a Shape abstraction from a DrawingAPI implementation from the very start of a graphics library's design, whereas an Adapter would be introduced later to make a third-party XmlParser library conform to your application's internal Parser interface.

Interview Tip: A concise interview answer is:

"Bridge is a deliberate upfront design that separates abstraction from implementation so both can change independently, while Adapter is a reactive fix that makes an existing, incompatible interface work with the one your code expects — Bridge is about design flexibility, Adapter is about integration."