---
title: "Comment by Thuan Do on \"Hexagonal architecture with Golang (part 2)\" | Hashnode"
description: "Can you highlight the differences between the hexagonal architecture and the layered architecture which each layer uses interface to communicate with others?"
url: "https://hashnode.com/posts/hexagonal-architecture-with-golang-part-2/64c86daa414741728981b3fb/comment/64c8f378e11157a514125c88"
---

[Discussion](https://hashnode.com/posts/hexagonal-architecture-with-golang-part-2/64c86daa414741728981b3fb)

Comment [Hexagonal architecture with Golang (part 2)](https://hashnode.com/posts/hexagonal-architecture-with-golang-part-2/64c86daa414741728981b3fb)

[Thuan Do](https://hashnode.com/@thn)

[Aug 1, 2023](https://hashnode.com/posts/hexagonal-architecture-with-golang-part-2/64c86daa414741728981b3fb/comment/64c8f378e11157a514125c88)

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

[AJ Phạm](https://hashnode.com/@ajpham)

[Aug 1, 2023](https://hashnode.com/posts/hexagonal-architecture-with-golang-part-2/64c86daa414741728981b3fb/comment/64c8f378e11157a514125c88#reply-64c90a70e11157a514125f38)

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](https://hashnode.com/@thn)

[Aug 1, 2023](https://hashnode.com/posts/hexagonal-architecture-with-golang-part-2/64c86daa414741728981b3fb/comment/64c8f378e11157a514125c88#reply-64c9370ee11157a5141265bd)

[AJ Phạm](https://hashnode.com/@ajpham) Thanks for the very detailed reply.
