Skip to content

Glossary: Software Design Patterns in Go

Adapter

Also written: adapters

A small type that holds an outside library object and offers the methods your code expects. At Kettle & Crane, `UpsCarrier` adapts the UPS rate service, which answers in cents, to the `Carrier` interface, which answers in dollars.

Where the book teaches it

Related terms

WrapperDecorator