liveBook · Manning

Driving adapter

As explained in Grokking Software Architecture

A hexagonal-architecture adapter that receives requests from outside the application, converts them into the core's terms, and calls a primary port.

A driving adapter brings an outside request to the application core. It translates the request into the core’s language, then calls a primary port—the interface through which the core receives that action. Think of it as a drawbridge: it lets a request in without bringing the outside world’s mess across the boundary. section 5.3.3 section 5.3.5

From HTTP request to core action

An OrderController can unpack a JSON HTTP request and call IOrderService.PlaceOrder(). The controller translates and hands off; business rules belong in the core, not in the adapter. section 5.3.3 section 5.3.5

Figure 5.6 Adapters translate the messy language of the outside world (JSON, SQL) into the clean language of the Core, and back again.

Use the figure to picture outside formats such as JSON being translated into the core’s terms. section 5.3.3

Driving adapters can include web controllers, command-line interfaces, and test adapters. Multiple entry points can drive the same application logic without changing it. Keep the primary port expressed in core concepts, not external types; a port that exposes a database type leaks infrastructure across the boundary. section 5.4.1 section 5.5.4 section 5.3.5

How Grokking Software Architecture covers it

How deep it goes
Defines request translation and port handoff with controller examples; defers detailed REST, GraphQL, and API design.
Examples
Uses an OrderController handling JSON, plus web, mobile, test, CLI, and background-job entry points.
What you can do after
Apply the pattern by translating external requests into core terms and handing them to a primary port.
How it connects
Connects to hexagonal architecture, ports and adapters, primary ports, domain-driven design, and the anti-corruption layer.

Also explained in

Compare how 2 books explain driving adapter →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.