CHAPTER 11The Adapter Pattern

The adapter pattern allows you to adapt existing interfaces to classes that would otherwise be incompatible. Objects that use this pattern can also be called wrappers, since they wrap another object in a new interface. There are many situations where creating adapters can benefit both the programmers and the interface designers. Often when designing classes, some interfaces can't be used with existing APIs. Adapters allow you to use these classes without modifying them directly. In this chapter we look at some of those situations and explore the ways in which the adapter pattern can be used to join objects together.

Characteristics of an Adapter

Adapters are added to existing code to reconcile two different interfaces. ...

Get Pro JavaScript™ Design Patterns 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.