3

I've been doing a lot of research on Hexagonal Architecture aka ports and adapters. I like the concepts, but struggling with some of the practicality. For example, the Domain isn't supposed to have the database access details (implementation). Instead that should be in the Framework layer. But there's a lot of "smarts" involved with data access in order to get the right data and it would seem to me that should belong in the Domain? So I'm looking for an example Java project that practically demonstrates the interactions between the Domain, Application, and Framework layers. Anyone know if something like this exists? I've not had much luck finding it. Lots of blogs about Hexagonal Architecture concepts, but nothing with concrete examples.

Michael Remijan
  • 596
  • 4
  • 14
  • You can refer to https://github.com/iluwatar/java-design-patterns/tree/master/hexagonal – Pramod Jun 12 '20 at 14:54
  • 1
    There is some nice looking example implementation of hexagonal architecture: https://allegro.tech/2020/05/hexagonal-architecture-by-example.html?fbclid=IwAR2Soxw1pA5nP8zgWXuqE0kA_AwTd3XtnU5r95LdDDUVk15NaAmHVCr9IBI – Kacper Jun 24 '20 at 13:56
  • This example was very helpful. thank you! – Michael Remijan Jun 25 '20 at 13:21

1 Answers1

1

I saw upvote on my comment, so I came with the idea that I will describe the best way to learn hexagonal architecture, in my opinion.

  1. Read what is DDD. Those two topics are practically the same. For this purpose I recommend the creator of this term Eric Evans and his book "Domain-Driven Design: Tackling Complexity in the Heart of Software".
  2. Read what is hexagonal architecture. There are good books. Uncle bob's: "Clean Architecture: A Craftsman's Guide to Software Structure and Design". Short description can be found here, on his website
  3. Watch some talks just in case. The one I found really helpful was Victor Rentea's presentation od Devoxx
  4. Analyse access modifiers in language you are developing. They are doing half the work.
  5. Work on it. Try to implement the way you understand it. Then you will see that those things works better those are missing and those are over engineering.
  6. Compare it with others code. It is really good feeling when you see that someone who has bigger experience implemented this the same way you did. This is the clue of this question. For this I recommend you this links.

Guy talk how important are access modifiers in hexagonal architecture. Example of code

Specific only implementation. Given in comment.

Kacper
  • 372
  • 4
  • 14