odrotbohm/sos

Order Repository should be hidden from "api" package, right ?

tahonaPL opened this issue · 2 comments

Hi,
I see two different approach between modulith and messaging-sos in hiding its internals ?

OrderRepository should be hidden from "api" package, right ? (controller should use abstraction or some "interactor/gateway/facade" or OrderManager?)

https://github.com/olivergierke/sos/tree/master/30-messaging-sos/sos-messaging-orders/src/main/java/example/sos/messaging/orders

Why should it? I see no point in creating a facade for the sake of only forwarding message calls. It might be worth introducing such an indirection if there's actual business logic that could be held in that intermediary. As long as that's not the case, I don't want to create an unnecessary indirection.

Fair enough. I just thought that it is overall good practice to hide internals, specially if its Repository with write functionality (Crud). From other hand it's a Order service, so there is no possibility that repository will be used in different context than Order Context. and this is a part of presentation just to show us a bigger picture. (I'm too picky :D )

Btw. Controller has bussines logic.