In a use cases–oriented architecture, such as Uncle Bob's Clean Architecture, if we do use a Presenter, should the front-end Controller (that already transmits the RequestModel to the IMyUseCase (via POO Interface)) also transmit the Presenter as a parameter (as a IMyUseCaseResponseHandler)?

Or should the ApplicationService, that hosts the use cases, already have an instance of the IMyUseCaseResponseHandler type, which would have been, for example, previously transmitted to it via Dependency Injection?

Or could this use case response handler even be a callback passed to the use case? Would you have an opinion on that?

  • Yes, you can do any of those depending on your needs; just make sure to maintain the dependency structure. Transmitting the Presenter as a parameter and passing a callback is very similar. Nov 15 at 16:26
  • Ok Filip, thanks a lot for your share of knowledge, it will help my decision. Nov 15 at 21:41
  • Sounds great, for the most part, but Id go with the (OOPS)) interface instead. But I guess it comes down to personal preference.
    – Nate T
    Nov 15 at 21:48
  • Ok thanks @NateT, it's interesting to see different perceptions and approaches, for the same goal. Nov 16 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.