Hexagonal Architecture: Use Case Part II

Written by vijay-aneryae | Published 2020/02/01
Tech Story Tags: software-development | software-architecture | technology | hexagonal-architecture | domain-driven-design | hexagonal-architecture-series | programming | engineering

TLDR Hexagonal Architecture: Use Case Part II. Hexagonal architecture is the application itself. The application is the medium through which business logic is accessed. Adapters are medium which serve the purpose of transforming the communications between various external actors and application logic through port. Port (API) Application (Application) Ports (Port) (Application), Ports (Ports) and Adapters (Adapters) All actors interact with the application through adapters. I hope this article will help you understand idea of hexagonal Architecture and who they are.via the TL;DR App

First of all, if you didn't read the previous post, please read first part before you jump into this section
Hexagonal Architecture: Introduction Part I
Today we are going to discuss about hexagonal archittecture with use case
There three basic components which hexagonal architecture talks about.
  1. Application (Domain Model)
  2. Ports
  3. Adapter

Application

Hexagon is the application itself. Inside the application we just have the things that are important for the business problem that the application is trying to solve.

Ports

Ports are the medium through which business logic is accessed.Port is a
use case boundary i.e. Ports correspond to use-cases in the application

Adapters

An adapter translates between a specific technology and a technology free port. Adapters is medium which serve the purpose of transforming the
communication between various external actors and application logic through port.
In hexagonal architecture all actors interact with the application
through adapters

User Case

Consider Loan Application use case.
A customer wants to apply for a loan application using online website or
using an ATM. Application then verifies the credit rating check
system,updates information in database and sends an update mail to the
customer
Hexagonal Bondries are
  • ApplyForLoan
  • CheckCreditRating
  • SaveCustomerInformation
  • SendEmail

Port (API):

  • LoanApplication Port (ApplyForLoan)

Port (SPI):

  • Credit Rating System Port (CheckCreditRating)
  • FTP Port (SaveCustomerInformation)
  • Notification Port (SendEmail)

Adapters:

  • Load Application Adapter (Assuming ATM machine interacts with the banking system using a REST API )
  • Credit Rating System Adapter (Interacts with credit rating check system.)
  • Send Notification Adapter ( Interacts with notification system )
  • FTP adapter (For intracting with FTp server to store customers information)

Conclusion

This is my understanding about hexagonal architecture.
If you want to get more information on the topic, read Alistair Cockburn’s original article on the subject
I hope this article will help you understand idea of Hexagonal Architecture and who they are comes together I’ll be glad for any feedback!

Published by HackerNoon on 2020/02/01