Hexagonal Architecture
Table of contents
- History
- Purpose
- Principles
- The separation of concerns
- Three Layers
- Inner layer isolation — dealing with dependencies
- Ports and Adapters
- Domain in isolation
- Direction of flow
- Ease of testing
- Sample with Spring and Kotlin
- Hexagonal vs Onion vs Clean
- Conclusion
- Reference
A bit of history
Published in a blog by Alistair Cockburn in 2005
The hexagonal architecture is synonym to “ports and adapters pattern”, but nowadays “hexagonal architecture” is better known. Moreover, it is a step further than the four (4) layered architecture that allows to separate the layers per responsibility. The hexagonal architecture on the other hand clearly suggests a focus on the domain isolation.
The term “hexagonal” comes from the graphical conventions that shows the application component like a hexagonal cell. The six borders represents the multiple interfaces that the component may expose to the external world.