DEV Community

loading...

Discussion on: Hexagonal Architecture doesn't really work

Collapse
jdottori profile image
jdottori

Graham, I agree that some parts of infrastructure define the ports. Anyway, it is not the infrastructure itself, but your requirements. You can always abstract everything, as Mark pointed out you can use a composed adapter. But on the other hand, performance would be negatively affected or you would need extra ceremony (and code) to do what you want.
I can mention another point on the same example of changing between Postgres and Mongo. Postgres will have integer autogenerated IDs, and Mongo will only use UUIDs. This is a problem when you define repositories in a typed language (like Java) and use something as Repository (as suggested in Spring or commonly implemented in DDD examples). You can always use another field as a real primary key in the database but this would impact the performance. So finally you need to choose what is going to be abstracted. That's the developer works, to choose between trade-offs.