Explain the concept of 'Input and Output Ports'.
Updated Apr 28, 2026
Short answer
Ports are interfaces that define how data enters (Input) and leaves (Output) the Use Case layer.
Deep explanation
An Input Port is typically the interface of the Use Case itself, called by the Controller. An Output Port is an interface (like a Repository) defined in the Use Case layer but implemented in the Infrastructure layer. This ensures the Use Case is 'closed' but allows for 'pluggable' implementations.
Real-world example
Hexagonal Architecture (Ports and Adapters) is a very similar conceptual model.
Common mistakes
- Putting technical details (like SQL types) in an Output Port interface.
Follow-up questions
- Is every interface a Port?