Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

N-Layer to Hexagonal (Ports and Adapters) architecture

Alistair Cockburn introduced a Hexagonal architecture, now it is called Ports and Adapters pattern. In my understanding, the concept is similar to n-layer architecture where one layer depends on the other layer via abstraction (interface) only. For example, the application layer depends on the many repository services interfaces rather it's implementation. There is no need of a separate implementation of a ports or adapters here. An IoC container like Unity can inject the implementation of the repositories, so adapters are not necessary.

Am I confusing this ports and adapters pattern with DIP (Dependency Injection Principle)?

Can someone point me to an implementation of the ports and adapters pattern? Thanks.

like image 678
wonderful world Avatar asked Jun 22 '13 18:06

wonderful world


People also ask

What is ports and adapters in hexagonal architecture?

The hexagonal architecture, or ports and adapters architecture, is an architectural pattern used in software design. It aims at creating loosely coupled application components that can be easily connected to their software environment by means of ports and adapters.

Is clean architecture same as hexagonal architecture?

Hexagonal Architecture and many other architectural patterns share the same goal: the separation of concerns. And they all achieve this goal by dividing the application into layers. And the Clean Architecture is just an attempt at integrating all these architectures into a single idea.

Why are hexagons good in architecture?

The hexagon allows radial organization as well as flat surfaces. A honeycomb-like grid can also be built upon or broken down into a triangular grid, while a hexagonal shape also lends itself to a larger number of external surfaces.

What is hexagonal architecture in Microservices?

Hexagonal architecture is a pattern that uses the mechanism of ports and adapters to achieve separation of concerns and isolate external systems and other external code such as user interfaces and databases from the core application.


1 Answers

I was looking for this myself.

Alistair Cockburn has an example with an explanation that might help you out and there was an example was given at this conference.

like image 97
user2342460 Avatar answered Oct 29 '22 16:10

user2342460