5

I tried searching the web but can't understand the difference/boundary between hexagonal(ports and adapter) architecture and ACL Pattern.

While hexagonal architecture talks about creating ports(interfaces) and adapters(implementation), doesn't ACL also do same by adding a layer which is corruption free and isn't impacted by any upstream or downstream system change?

1 Answers1

7

These are orthogonal architectures:

  • The anticorruption layer is an architectural pattern that intends to isolate one bounded context from the modifications of another bounded context, at the domain design level.
  • The hexagonal architecture does not prescribe anything about domain design, and just provides a way, using dependency injection, to isolate the core of an application from the rest of the world using the ports to isolate the services needed and provided, thus facilitating interchangeability.

The key point here, is that ACL does not imply a traditional layered architecture (see this other question about layered and hexagonal architectures), but is about domain objects and their interface, and hexagonal architecture is not about domain objects but about organizing the interfaces with outside.

You can therefore combine the two, using DI to define the ACL objects/services, and plug them via a port to another service implementing the other domain.

Christophe
  • 81,699