From the course: Software Architecture: Patterns for Developers

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Ports and adapters (or hexagonal)

Ports and adapters (or hexagonal)

- [Instructor] Now it's time to explore the ports and adapters architecture, also called the hexagonal architecture. Like the onion architecture, the core module is the business logic or the domain. This core then defines the interfaces it needs to interact with the outside world. These are called the ports. Finally, there are specific implementations that use or implement these ports. We call those the adapters. The pattern distinguishes between primary and secondary adapters. Primary adapters drive the application, which means they make calls to the domain. Secondary adapters, on the other hand, are driven by the application, meaning they get called by the domain. As an example, a primary adapter could be a user interface, console application, or unit tests. Examples of secondary adapters are blob storage clients, SQL server repositories, or even fake implementations for the unit tests. You may think that this doesn't differ a lot from the onion architecture, and you're right, but…

Contents