Considering Uncle Bob's Clean Architecture (or Onion Architecture)
I have the following scenario:
- I want to show the user, information of a place: name, category, coordinate.
- I also want on the same screen, a button, that when clicked, redirects to a Map app showing the location of that place.
To redirect to the Map app, there is a simple framework API that receives a coordinate.
For the first problem, I should have a RetrievePlaceInformationInteractor
(use case) that would receive a place id and return the name, category and coordinate.
But for the second problem, I don't know if I should:
- have a separate
OpenPlaceInMapInteractor
(use case) that would receive the place id and return the coordinate to be used by that framework API in thePresenter
. - have a separate
OpenPlaceInMapInteractor
(use case) that would receive the place id and use that framework API to redirect to the Map app. - use the same
RetrievePlaceInformationInteractor
to get the coordinate and fill it in a callback, that calls the framework API, and that would be called when the OpenInMap button was clicked.
The first seems a bit stupid, since it would essentially be an interactor just to retrieve one property, that is already being retrieved by another interactor.
The second forces the OpenPlaceInMapInteractor
to access a framework API, which kinda defeats the purpose of the interactor layer not accessing the above layers (sure, I could use a protocol for the API and use dependency injection, but still, I'm relying on a framework specific feature).
The third seems reasonable, but wouldn't I be implementing 2 use cases in one?
What should I do?
Thank you.