Hexagonal architecture (software)

It aims at creating loosely coupled application components that can be easily connected to their software environment by means of ports and adapters.

[1] The hexagonal architecture was invented by Alistair Cockburn in an attempt to avoid known structural pitfalls in object-oriented software design, such as undesired dependencies between layers and contamination of user interface code with business logic.

[1] In April 2024, Cockburn published a comprehensive book on the subject, coauthored with Juan Manuel Garrido de Paz.

Ports and protocols define an abstract API that can be implemented by any suitable technical means (e.g. method invocation in an object-oriented language, remote procedure calls, or Web services).

They tailor the exchanges between the external world and the ports that represent the requirements of the inside of the application component.

Example of hexagonal architecture with an inner hexagon representing the application core, and an outer hexagon for the adapters, the border between the two being the ports
Example of hexagonal architecture