vkhorikov/AutoBuyer

Coupling the domain model to the Warehouse API

Closed this issue · 1 comments

Amazing course! I really enjoyed it and learned a lot. I wanted to ask you the following question. With the given implementation of the StockEvent and StockCommand classes, don't we couple our domain model to the language of the external Warehouse dependency (for example the string: "Event: CLOSE;")? It seems like our domain model conforms to the external service's language/API. I would expect something like a translation/ACL in something like a WarehouseGateway. What do you think?

Discussed this question over the email, posting the answer for reference:

If there's just one stock exchange we integrate with, I wouldn't worry about it. But if there are multiple, then yes, the best way would be to have our own internal nomenclature and then map it to the Ids/Codes specific to a particular provider.