My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
AJ Phạm

3 likes

·

1.2K reads

3 comments

Thuan Do
Thuan Do
Aug 1, 2023

Can you highlight the differences between the hexagonal architecture and the layered architecture which each layer uses interface to communicate with others?

1
·
·2 replies
AJ Phạm
AJ Phạm
Author
·Aug 1, 2023

Sure, I can provide some special difference between them:

Purpose:

  • Hexagonal: isolation of the core business logic from external component (framework, external technical, ...).
  • Layer: Organizes the application into horizontal layers, each with specific responsibilities.

Dependency Direction:

  • Hexagonal: Core application is at the center and independent of external systems. Adapters depend on the core through interfaces (ports).
  • Layer: Dependency from higher to lower layers.

Flexibility:

  • Hexagonal: easy swapping of adapters. Changes in external systems can be accommodated without modifying the core logic.
  • Layer: it is also flexibility but changes may involve modifying multiple layers due to tighter coupling between layers.

Testability:

  • Hexagonal: High testability, as the core application can be tested independently using mock or fake implementations of interfaces.
  • Layer: Supports testability, but may have less isolation between components within the same layer, making unit testing more challenging.
·
Thuan Do
Thuan Do
Aug 1, 2023

AJ Phạm Thanks for the very detailed reply.

1
·