Hexagonal Architecture
A software architecture pattern proposed by Alistair Cockburn in 2005, also known as the Ports and Adapters architecture. Its central idea is to place business logic at the core and interact with the outside world through abstract ports, with adapters responsible for translating external technologies so that the business core remains independent of specific implementations.
Timeline (last 90 days)
In Agent channel integration scenarios, the adapter pattern is usually implemented as a ports-and-adapters architecture (hexagonal architecture): the Agent core defines abstract ports (such as receive_message and send_reply), and each channel implements its corresponding adapter.
CodebaseRAG adopts a hexagonal architecture, where query use cases depend on ports, and pgvector, Qdrant, Ollama and Anthropic sit behind the ports as adapters.
In every round of this experiment, the flat version without architectural constraints consistently took less time overall.
The hexagonal architecture version consumed more input and output tokens overall.
The time saved by the hexagonal architecture in the database extension scenario was not enough to offset the cumulative time gap accumulated across the preceding fifteen-feature sequence.
In the scenario of adding PostgreSQL support while retaining SQLite, the hexagonal version completed in approximately 39 minutes with no changes to the core application code, while the flat version took 71 minutes.
The experiment built two versions of the same Java sample application: one using hexagonal architecture (with ports, adapters, and architecture tests), and the other a flat version with no architectural constraints, both of which needed to pass the same set of external test cases.
Hexagonal Architecture, also known as the Ports and Adapters pattern, has a core philosophy of isolating different concerns through clear boundaries and interfaces, allowing each layer to evolve and be replaced independently.
All Facts (9)
Hexagonal Architecture (also known as Ports and Adapters Architecture) was proposed by Alistair Cockburn in 2005, with the core idea of decoupling business logic from external dependencies.
60%UnverifiedIn Agent channel integration scenarios, the adapter pattern is usually implemented as a ports-and-adapters architecture (hexagonal architecture): the Agent core defines abstract ports (such as receive_message and send_reply), and each channel implements its corresponding adapter.
50%UnverifiedCodebaseRAG adopts a hexagonal architecture, where query use cases depend on ports, and pgvector, Qdrant, Ollama and Anthropic sit behind the ports as adapters.
50%UnverifiedIn every round of this experiment, the flat version without architectural constraints consistently took less time overall.
50%UnverifiedThe hexagonal architecture version consumed more input and output tokens overall.
50%UnverifiedThe experiment built two versions of the same Java sample application: one using hexagonal architecture (with ports, adapters, and architecture tests), and the other a flat version with no architectural constraints, both of which needed to pass the same set of external test cases.
50%UnverifiedThe time saved by the hexagonal architecture in the database extension scenario was not enough to offset the cumulative time gap accumulated across the preceding fifteen-feature sequence.
50%UnverifiedIn the scenario of adding PostgreSQL support while retaining SQLite, the hexagonal version completed in approximately 39 minutes with no changes to the core application code, while the flat version took 71 minutes.
50%UnverifiedHexagonal Architecture, also known as the Ports and Adapters pattern, has a core philosophy of isolating different concerns through clear boundaries and interfaces, allowing each layer to evolve and be replaced independently.
50%