Hexagonal Architecture
Created by Alistair Cockburn in 2005, Hexagonal Architecture is a powerful design pattern that is also referred to as ports and adapters or an onion architecture.
What is a Hexagonal Architecture?
Hexagonal architecture is a way of designing software which is intended to reduce coupling and increase our ability to test and maintain business logic.
The way it does this is by defining the public API of a system or a component as an interface, referred to as a "port".
Our implementation of this interface or public API, is the "adapter". This allows us to translate/integrate between external systems and the format which the core API or "port" understands.
Our "ports" or public API, can be further broken down into "incoming" and "outgoing", providing semantic clarity and standardization.
We can interface our core business logic with multiple adapters. The business logic has it's domain model and the adapters can have their own model or representation of that domain.
Benefits of a Hexagonal Architecture
- Low coupling and flexibility
- Better testability of core logic
- Promotes a modular structure
- A form of standardization or open pattern that can aid in developer productivity and developer on-ramping
- Polyglot friendly
Links and Resources
https://alistair.cockburn.us/hexagonal-architecture - Alistair Cockburn, Hexagonal Architecture