liveBook · Manning

Primary port

As explained in Grokking Software Architecture

An interface through which an external actor invokes an application's core functionality.

A primary port is an interface that defines how the outside world can use an application. Users, tests, or external systems reach it through a primary adapter, which calls the port to invoke core functionality. section 5.4.1 section 5.3.2

An order-service port

An IOrderService might define PlaceOrder() and CancelOrder(). An OrderController can translate an HTTP request and call PlaceOrder() through that interface. section 5.3.2 section 5.3.3

Figure 5.5 Display showing how Ports interact with the Domain. Ports can share interfaces or be distinct; it all depends on cohesion (e.g., one IOrderPort vs. separate Ports).

Ports can share an interface or use distinct interfaces, depending on cohesion. section 5.3.2

How Grokking Software Architecture covers it

How deep it goes
Defines ports as interfaces and illustrates order-service operations, but does not detail implementation or method design.
Examples
Uses IOrderService.PlaceOrder() and CancelOrder(), called by an OrderController after translating an HTTP request.
What you can do after
Apply it by defining an interface for application actions and having a driving adapter call it.
How it connects
Links primary adapters, the application core, secondary ports, and hexagonal architecture.

Also explained in

Compare how 2 books explain primary port →

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.