Chapter    13

The Bridge Pattern

The bridge pattern can be confusing. It looks similar to the adapter pattern I described in Chapter 12, but its use can seem counterintuitive. In this chapter, I focus on the problem that the bridge pattern is most commonly used to resolve and explain why the biggest difference between the bridge and adapter patterns is intent rather than implementation. Table 13-1 puts the bridge pattern into context.

Table 13-1. Putting the Bridge Pattern into Context

Question

Answer

What is it?

The bridge pattern separates an abstraction from its implementation so that either can be changed without a corresponding change in the other. More commonly, the bridge pattern is used to resolve a problem known as an exploding class hierarchy ...

Get Pro Design Patterns in Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.