archi3

Comparison

Three answers to three different questions

Hexagonal, Clean Architecture and DDD are almost always presented as competing choices. In reality, they answer different questions and combine naturally in most serious projects.

HexagonalClean ArchitectureDDD
Author, yearAlistair Cockburn, 2005Robert C. Martin, 2012Eric Evans, 2003
Question it asksHow do we isolate the business logic from technology?Which way should dependencies point?What model belongs in the business logic, and how is it split?
Central unitThe domain, at the center of the hexagonEntities, at the center of the circlesThe aggregate, inside a bounded context
Boundary vocabularyPorts (driving / driven) and adaptersInterface adapters, the Dependency RuleContext mapping (ACL, Shared Kernel, Conformist...)
What it guaranteesThe business logic tests without a framework or databaseNo dependency points from inside to outsideThe code speaks the same language as the domain experts
Weak point if misappliedPorts that mirror a SQL schema (CRUD in disguise)Over-layering a trivial app into four circlesTactical patterns with no Ubiquitous Language or bounded context

How they fit together

DDD answers the question of content: what should live in the core of the system, and how should it be split into coherent models (bounded contexts)? Hexagonal and Clean Architecture answer the question of structure: once that core is defined, how do we protect it from everything around it?

In practice, DDD's entities and aggregates sit exactly where the hexagonal core or Clean Architecture's "Entities" circle sit. The repositories DDD defines as part of the domain are driven ports in the hexagonal sense. None of these three approaches conflict - they describe the same building from three different angles.

Where to start

Always: the Ubiquitous Language

Talking to the people who use the system and naming the code exactly as they name things costs nothing and prevents most misunderstandings, regardless of project size.

Almost always: ports and adapters

Isolating the business logic behind a few simple interfaces keeps tests fast and makes technology changes less risky, even on a modestly sized application.

Only if the business is genuinely complex: aggregates, multiple bounded contexts

These patterns carry a real design cost. They pay off against authentic business complexity (many rules, strict invariants, multiple teams) - not on a three-screen CRUD app.