liveBook · Manning

Adapter

The adapter pattern is a structural design pattern in which a component translates between interfaces or representations so otherwise incompatible components can work together.

How 9 Manning books explain it

gRPC Microservices in Go

An adapter is a boundary component that transforms requests between an external actor or technology and an application's internal interfaces.

How it is used
Isolates microservice business logic from incoming interfaces and external systems by translating requests across ports.
How deep it goes
Works through port contracts, a GORM-backed database adapter, and startup wiring rather than stopping at the pattern definition.
Examples
Uses an Order service's GORM/MySQL persistence adapter, gRPC entry point, and payment-service adapter.
What you can do after
Build it from scratch by implementing a port contract in an adapter and injecting that adapter into a Go service.

Read how gRPC Microservices in Go explains adapter →

Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

An adapter pattern converts one interface into another interface expected by clients so incompatible components can work together.

How it is used
Maps provider-neutral infrastructure metadata into provider-specific interfaces for reusable modules and resources.
How deep it goes
Defines the transformation and demonstrates role mapping, while deferring complete troubleshooting and testing details.
Examples
Uses Python-oriented identity mappings that translate generic permissions into GCP, AWS, or Azure role terminology.
What you can do after
Apply it to isolate provider-specific changes while extending infrastructure modules across providers.

Read how Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform explains adapter →

Software Design for Python Programmers

The Adapter pattern is a software design pattern that makes incompatible interfaces work together through an intermediary interface translation layer.

How it is used
Integrates unchangeable external or legacy classes with existing clients that require a different interface.
How deep it goes
Explains object and class adapters through a refactored sports application, then compares their selection trade-offs.
Examples
Uses a sports attendance report, GameData, FootballInfo, VolleyballStats, FootballData, and VolleyballData as concrete artifacts.
What you can do after
Build it from scratch by wrapping or inheriting from incompatible classes and exposing the target interface expected by clients.

Read how Software Design for Python Programmers explains adapter →

Object-Oriented Software Design in C++

The Adapter Design Pattern is a structural design pattern that converts one interface into another interface expected by clients so otherwise incompatible components can work together.

How it is used
Integrates external or legacy components with application clients when their interfaces cannot be changed or do not match.
How deep it goes
Explains interface conversion through wrapping, client simplification, generic roles, and multiple-inheritance alternatives.
Examples
Uses shape and text interfaces, plus FootballInfo and VolleyballStats adapted for an AttendanceReport.
What you can do after
Build it from scratch by implementing a target interface, wrapping an incompatible object, and translating its operations for clients.

Read how Object-Oriented Software Design in C++ explains adapter →

Unit Testing Principles, Practices, and Patterns

A design pattern that presents an application's interface over a different interface supplied by an external component or library.

How it is used
Separates application code from third-party libraries when testing unmanaged dependencies.
How deep it goes
Defines the abstraction, rationale, and maintenance risks, but does not detail adapter implementation.
Examples
Uses an IBus message-bus wrapper and BusSpy or Moq interaction verification.
What you can do after
Apply it by defining project-owned interfaces over third-party dependencies and mocking those interfaces.

Read how Unit Testing Principles, Practices, and Patterns explains adapter →

Go in Action, Second Edition

The adapter pattern presents an existing component through an interface compatible with the surrounding application's expectations.

How it is used
Connects a worker’s domain Fetcher port to an external RSS parsing library without exposing infrastructure types.
How deep it goes
Demonstrates interface implementation, model translation, compile-time checking, dependency direction, and replacement, but not adapter variants.
Examples
Uses RSSReader, gofeed.Parser, domain.Fetcher, Feed and Article conversions, and worker fetch-and-store processing.
What you can do after
Build it from scratch by defining a domain port, implementing an infrastructure wrapper, translating models, and asserting interface compatibility.

Read how Go in Action, Second Edition explains adapter →

The Art of Unit Testing 3e

An adapter is a component that abstracts or translates an underlying dependency behind a replaceable interface.

How it is used
Improves asynchronous unit testing by replacing inherently asynchronous dependencies with controllable adapters and fakes.
How deep it goes
Explains three adapter forms, focused interfaces, injection, and Jest substitution through network-fetch examples.
Examples
Uses a node-fetch network adapter, website verification, Jest mocks, functional injection, and TypeScript interfaces.
What you can do after
Apply it via modular, functional, or object-oriented designs to isolate asynchronous dependencies in tests.

Read how The Art of Unit Testing 3e explains adapter →

The Art of Code

A compatibility adapter is an intermediary component that translates between an older interface or data format and a newer one.

How it is used
Preserves client compatibility while exposed interfaces, endpoints, or data formats evolve.
How deep it goes
Defines the translation layer and weighs its maintenance cost, but stops short of implementation detail.
Examples
Uses changing endpoint URLs, old and new formats, deprecated methods, and versioned entry points as compatibility cases.
What you can do after
Evaluate when translation layers can reduce disruption and when their maintenance burden outweighs the benefit.

Read how The Art of Code explains adapter →

Effective Platform Engineering

An adapter pattern is a design pattern that standardizes interaction between incompatible interfaces or data representations by translating one into another.

How it is used
Standardizes release and deployment events so platform APIs and consumers can integrate diverse engineering systems.
How deep it goes
Explains adapter boundaries, event normalization, publisher-consumer separation, and observability correlation without detailing adapter implementation code.
Examples
Uses GitHub, CircleCI, Kubernetes, ArgoCD, Flagger, OpenTelemetry, metrics platforms, and deployment-event correlation as concrete examples.
What you can do after
Diagnose deployment-related incidents by correlating normalized release events with service health metrics.

Read how Effective Platform Engineering explains adapter →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.