Ports and Adapters Pattern

The ports and adapters pattern isolates core business logic so it can be used in a variety of contexts and tested in isolation from components that provide data and events. At runtime, pluggable adapters for specific input sources can be injected into the core business logic to provide access to events and data. Adapters can be swapped at build-time or runtime to create different configurations of the software system. Use this pattern when the system must support multiple input devices or when there is a risk that input devices could change.

This pattern was initially described by Alistair Cockburn under the name Hexagonal Architecture.[8] See the table.

Category

Module or Component & Connector

Elements

Layer—Contains ...

Get Design It! 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.