How does this help me build maintainable software?
The Hexagonal Architecture style cleanly separates domain logic and outward-facing adapters. This helps us to define a clear testing strategy that covers the central domain logic with unit tests and the adapters with integration tests.
The input and output ports provide very visible mocking points in tests. For each port, we can decide to mock it or use the real implementation. If the ports are each very small and focused, mocking them is a breeze instead of a chore. The fewer methods a port interface provides, the less confusion there is about which of the methods we have to mock in a test.
If it becomes too much of a burden to mock things away, or if we don’t know which kind of test we should use to cover a certain part of the code base, that's a warning sign. In this regard, our tests have the additional responsibility of being a canary – to warn us about flaws in the architecture and steer us back on the...