Sorry if there's already a thread about this, I tried to search for it but didn't find anything.
Trying to build my application, I was re-watching E18 and there is something I don't know the answer for. Who and where creates the Presenter? Either the Controller or the Interactor will need to hold a reference to it in order to present the use case response but I can see no component pointing in the direction of the View component, so nothing to create the Presenter instance.
This made me think it could be referenced and built by something in Main based on the type of use-case response expected.
The thing is, there could be multiple uses of a use-case (not completely sure about this though), for example:
- Use-case: get customers from the system
- In View A we want to display all the customers ordered by their name
- In View B we want to display the top 20 customers by their registration date
The use-case interactor could take some filtering arguments in the request from controllers A and B, but organizing and ordering the data it returns would be handled in presenters A and B for their respective views.
- How would Main know which presenter to fire up?
- Should the controllers build the presenters instead as they will know more about the circumstances? Or would we want to prevent introducing a dependency pointing from the Controller component to the View component (containing the presenter)?
- Should the presenters be build somewhere else? Where?
- I might be absolutely wrong assuming reuse of a use-case but the scenarios look very similar.
- Am I completely missing something?
Thanks in advance!