Software systems consist of two main elements: business logic and technical logic. Technical logic enables interaction with business logic. *Ports and Adapters* is an architectural pattern designed to prevent these two types of logic from infiltrating each other. It allows users, programs, automated tests, and batch scripts to interact with the system consistently.
This consistency is achieved by applying the [[Dependency Inversion Principle (DIP)]] and the [[Adapter pattern]]. These techniques abstract the interaction between business and technical logic, ensuring both adhere to a specified protocol.
This protocol is defined by ports within the business logic and implemented by technical logic, typically through an adapter. This approach allows for the independent development and testing of business logic separately from technical logic, which is the essence of the *Ports and Adapters* pattern.
Ports enable interactions by allowing technical logic to drive business logic or vice versa. The distinction depends on which side initiates the interaction. Technical logic drives business logic through primary ports and adapters, while business logic drives technical logic through secondary ports and adapters.