Question 1: What is the correct way to build a Use Case (or more than one) with 2 ways to do the same action?
For example:
I have a 3 screens in
Question: What to do when 2 use cases are related to the same presenter/view? For example, I have a presenter/view that
Answer
It seems that you are dealing with non-trivial use-case modelling scenarios.
"Check user-login" does not need use case. Similarly, if location authorization is not being updated as part of configuration settings, then it is also not a use-case. They are not good candidates for use-case modelling but rather preconditions or "steps" in other complex use cases. I think they are more like preconditions then "steps" and certainly not individual "use-cases" themselves.
Preconditions should be accompanied by use-case exceptions and non-trivial "steps" hints use-case-reuse via include-dependencies. If preconditions fails, you can provide appropriate messages and options to fulfil those conditions. For complex steps, one use case redirect to other use-case.
The idea is to either opt for exceptions that will terminate the use case with valid message on failed preconditions OR include other use-cases that will ask user to log-in first and resume current use case.
The goal is to break down complex requirements and re-use them. Quoting from Use Case Reuse - Include Dependency. "You use include dependencies whenever one use case needs the behavior of another. Introducing a new use case that encapsulates similar logic that occurs in several use cases is quite common."
Thus,
CreatePlaceInteractor
should take dependency on UserLogInInteractor
and LocationAuthorizationInteractor
and call them when necessary.CreatePlaceInteractor
should send back data that Presenter can interpret and ask Wireframe to launch UserLoginPresenter
and/or LocationAuthorizationPresenter
.This will involve carefully designed interactions and navigation for control flow and data flow using Interactors, Presenters and Wireframes. In the process, you will be challenging lot of core assumptions and hidden unhandled system behaviour.
Since other use cases may also include user-login or authorization-access to finish their task, these use cases should be included but not necessarily executed all the time - conditional function call to UserLogInInteractor and LocationAuthorizationInteractor. If user is logged in and authorization access is already allowed, they will be skipped. When user chooses CameraView, check for user-login and location access. When user chooses EditView directly from MapView, check for for user-login only.
I think you should implement precondition logic into your Interactors and Presenter can use it to make Presentations and Navigations related decisions.
Considering following list of Use Cases:
Preconditions:
Steps:
Steps:
Steps:
Steps:
Steps:
Steps: