8

I am trying to improve the architecture for my React app project that has grown in size lately.

I'm looking at Hexagonal architecture and Clean architecture, and I couldn't really see the difference between them.

In Hexagonal, there are main elements like "entities -> port -> adapter".

In clean architecture, there are elements like ENTITIES -> USECASE (similar to adapter) -> INTERFACE (similar to port) and External

Is Clean architecture superset of Hexagonal, or they are different? If they are different, what makes them distinct from each other?

2 Answers2

13

Bob Martin's blog entry about Clean Architecture explains it in one sentence:

"The diagram at the top of this article [Clean Architecture] is an attempt at integrating all these architectures [including Hexagonal Architecture] into a single actionable idea."

So "Clean Architecture" is not just "one architecture", it is collective term for several architectural variants, all sharing the same ideas, and Hexagonal is one of them. Maybe a more precise title for that blog post would have been "Clean Architectures", but I guess Bob Martin favored something more striking like "The Clean Architecture" for self-marketing reasons. Hence, it is not surprising you don't see a lot differences between the two terms.

Evorlor
  • 1,563
  • 3
  • 18
  • 23
Doc Brown
  • 218,378
1

I too don't see the difference. Their goals are the same. To separate the interesting business logic from external dependencies, so the logic can be reasoned about and tested in isolation from those dependencies.

The only difference I can see is that hexagonal architecture focuses more on how the boundary between the core and external systems is implemented. While Clean architecture worries more that the separation exists in the first place, irrespective how the boundary is implemented. But I don't believe that is a useful distinction.

Euphoric
  • 38,149