Introduction: Hexagonal Architecture—Decoupling External Systems

Get yourself introduced to what we will learn in this section.

We'll cover the following

We’ve already learned how to write tests using the arrange, act, and assert template. We’ve also learned about some software design principles, known as the SOLID principles, that help us break our software down into smaller components. Finally, we’ve learned how test doubles can stand in for collaborating components to make FIRST unit tests easier to write.

Hexagonal architecture

In this section, we’re going to combine all those techniques into a powerful design approach known as the hexagonal architecture. Using this approach, we will benefit from getting more of our application logic under unit tests and reducing the number of integration and end-to-end tests required. We will build in a natural resilience to changes outside our application.

Development chores such as changing a database supplier will be simplified, by having fewer places where our code needs to be changed. We will also be able to unit test across larger units, bringing some tests that require end-to-end testing in other approaches under unit tests instead.

Section goals

In this section, we’re going to cover the challenges posed by external systems, such as environmental issues and uncertain data, while mastering robust software development and testing. Dive into enhancing testability and maintainability through dependency inversion within the hexagonal architecture, abstracting external systems, refining the domain model, and optimizing testing efficiency with FIRST unit tests.

Get hands-on with 1200+ tech skills courses.