DEV Community


Discussion on: Hexagonal Architecture doesn't really work

mark_nicol profile image
Mark Nicol

Yes, I see what you mean...

You could see your 'big' hexagon as having within it two smaller hexagons that represent how that particular solution is composed.

One for cloud search and one for DynamoDB. Which I think is okay if neither DynamoDB or CloudSearch are used independently anywhere else. The ports between CloudSearch and DynamoDB are on the internal faces as they don't affect the larger solution. Things that are used outside are on the external faces.

Then you could still swap out one of those smaller hexagons for one that supported the same combination of ports.

I don't know myself if that deviates too far from the spirit of hexagonal architecture though.

Thread Thread
grahamcox82 profile image
Graham Cox Author

Hmm - That's interesting.

So you end up with:

  • The actual service in question, which exposes an XxxRepository port.
  • An implementation of the XxxRepository that just calls Postgres
  • An implementation of the XxxRepository that is a hexagon of its own, and which exposes two ports - XxxDataStoreRepository and XxxSearchRepository
  • An implementation of XxxDataStoreRepository for DynamoDB
  • An implementation of XxxSearchRepository for CloudSearch
  • An implementation of XxxSearchRepository for Elasticsearch

It works. It feels quite complicated, but it works. :)