1. Overview

Hexagonal Architecture is a pattern introduced by Alistair Cockburn, also known as the Ports and Adapters. It enforces inward dependencies to the Core Domain, which allows developers to test and develop features in isolation.

To visualize the usage of this pattern, let’s explore a simple scenario with an Online Store domain. Typically, a change in order status leads to the sending of a notification to the customer.

With the preceding scenario in mind, this article shows how to implement the Core Domain, Ports, and Adapters.

2. Core Domain

The Core Domain is where the business logic lives. As mentioned earlier, Imagine we’re dealing with an Online Store domain. For simplicity, let’s use POJOs.

First, let’s define a _Customer _domain:

public class Customer {

	    private String id;
	    private String name;
	    private String email;

	    public Customer(String id, String name, String email) {
	        this.id = id;
	        this.name = name;
	        this.email = email;
	    }

	}

#programming #java #software-engineering #software-architecture #software-development

What is Hexagonal Architecture
1.90 GEEK