Hexagonal architecture

Alistair Cockburn came up with the hexagonal architecture, or ports and adapters. In his blog, he wrote the intent of this architecture, as follows:

Allow an application to equally be driven by users, programs, automated test or batch scripts, and to be developed and tested in isolation from its eventual runtime devices and databases.

The following diagram depicts the hexagonal architecture, from Vaughn Vernon's book, Implementation Domain-Driven Design, with a few modifications:

Figure 6.12: Hexagonal architecture

As you can see in the preceding diagram, at the center is the Application core. It contains all of the business logic and creates a boundary. And at the heart, it is the Domain Model, which contains rich behavior domain models, not anemic ones. Around the Application core are the Adapters that translate outside events that arrived at different ports into API calls to the Application core, such as the A, B, and C adapters in the diagram. Other adapters, such as Adapter E, interact with the database, while Adapter F interacts with Elasticsearch. Adapter G saves data in memory. Note that all of the arrows in the diagram are unidirectional to indicate which interactions were triggered from which side. It doesn't mean that the interaction is in one direction.

The hexagonal architecture is a natural fit for Domain-Driven Design (DDD). It isolates the domain logic from the infrastructure, such as the database, search engine, message queue, mail delivery, and the cache system. It can be extended to support different types of clients easily. Just add a new adapter to it. 

For TaskAgile, we will use hexagonal architecture and practice DDD. We will discuss this architecture in detail along the way. Meanwhile, if you're interested to learn more about the hexagonal architecture, I recommend that you read Alistair Cockburn's blog on hexagonal architecture and the C2 wiki at http://wiki.c2.com/?HexagonalArchitecture.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.196.146