Ports
The domain speaks through ports, never directly to infrastructure.
Ports are interfaces — they declare what the domain needs without specifying how. Driving ports accept commands from the outside. Driven ports request services from the outside. The domain owns both.
Context
- Adapters — Concrete implementations plugged into ports
- Hexagonal Architecture — The pattern that separates domain from infrastructure
Questions
How do you know when a port interface is at the right level of abstraction?
- What breaks when a port leaks infrastructure concerns into the domain?
- When should a single port split into multiple narrower interfaces?