The hexagon is just used to represent the whole concept in simple language. Just because a hexagon has six sides, it doesn’t mean only six ports can be present in hexagonal architecture. Each side of the hexagon is representing a port. The adapter layer lies between the core and the outer hexagon. The inner hexagon depicts the core of the application, the application logic, and the business. To understand this concept better, let's quickly look into the below diagram.Īs you can see in this diagram, there are two hexagons, one inside the other.
A port isolates the inputs and outputs that are reaching or leaving the application from the external technologies, delivery mechanics, and tools. The core concept behind Hexagonal Architecture (also known as Ports and adapters pattern) is that the application is central to the system. Hexagonal Architecture is an architecture pattern that helps in solving problems related to the maintenance of applications in traditional architecture (Database-centric architecture).
The major appeal of using hexagonal architecture is that it makes the testing of code easier. The outputs and inputs at the edge mean the swapping of their handlers is done without altering the core code. The central logic or the application’s core logic is separated from any outside interventions. In such a model, you put outputs and inputs at the edge of the design.
Most software applications are designed using the hexagonal architecture model.