Use case with two methods for the same action

Question 1: What is the correct way to create a use case (or more than one) with two ways to do the same thing?

For instance:

I have 3 screens in the iOS application:
1. View of the map, which you can "long press" and have a camera button.
2. The camera view that is displayed if the user clicked the camera button on the map screen.
3. Type of editing the place / output, which is displayed if the user "long presses" on the map image or after the user has selected a photo on the camera screen. There is a save button in this edit window to actually create a place with a photo and location (long press on the coordinate or current location if you click the camera button).

Name: Create a place. Main stream:
 1. User "long press" on the map.
 2. The application deletes the temporary output and displays the edit view of the place.
 3. The user edits the location information and presses the save button.
 4. The application creates a place and saves it.

Name: Create a place. Main stream:
 1. The user presses the plus button.
 2. The application displays the camera view.
 3. The user takes a picture.
 4. The application creates a place with the current location and image.

UPDATE based on comments exchanged with bhavik.

2: ( )
, 1 3 /.

  • / , ,
  • / ,
  • / , " " , / .

?

3: ?
bhavik - , VIPER blog Bob, , , /.

4: VIPER , , , . ?

5: - - " ", ? , ( ), , " ".

+4
4

1: ( ) ?

VIPER Interactor, .


2: ( ) , 1 3 /.

, , .

  • Presenter/View Interactor.
  • Presenter/View - Interactor , CameraView.
  • , Wizards.
  • / Interactor.
  • Interactor .
  • Interactor . 1-1.

, EditPlacePresenter/View EditPlaceInteractor, . .


3: ?

bhavik - , VIPER , , /.

, Presenter, Interactor.

- (void)foundUpcomingItems:(NSArray*)upcomingItems

, , Interactor , / Presenter/Controller, . , Presenter/Controller Interactor, return-function Interactor. ?

, Interactor . , Interactor EditPlaceResult .

  • , , Place ID.
  • , .

. , . , Interactor Presenter, , Map Place .

:

  • Presenter Interactor.
  • , Interactor, .
  • Interactor , .

4: VIPER , , , . ?

VIPER :

  • : MapView CameraView ( )
  • : MapView EditPlaceView ( )
  • : CameraView EditPlaceView
  • : Interactor / MapView
  • "":

VIPER, .

Wireframe VIPER , , .

Wireframe .

  • UINavigationController UIViewController
  • View/ViewController
  • Wireframes ,

Presenter

  • , VIPER View Controllers , . !
  • , -, - !

5: - - " ", ? , ( ), , " ".

. Interactor. . . , CameraView/Presenter Interactor, EditPlaceView .


: , , . MVC, MVP, MVVM, VIPER , View, Logic Navigation .

, . , . , , , , .

, , , . , Wireframe. .

+11

: , 2 /? , /,

  • , ,
  • , - .

, .

" " . , , . , "" . , , "" , , " ".

"". , . .

, , , .

, . - . " include, . , , , ".

VIPER

  • , .
  • Interactors Entities .
  • .
  • , .
  • Wireframe.
  • .

,

  • CreatePlaceInteractor UserLogInInteractor LocationAuthorizationInteractor .
  • CreatePlaceInteractor , , Wireframe UserLoginPresenter / LocationAuthorizationPresenter.

Interactors, . .

- , , - UserLogInInteractor LocationAuthorizationInteractor. , . CameraView, . EditView MapView, .

, Interactors, Presenter , Navigations.

:

  • "UC001: ".
  • "UC002: ".
  • "UC003: ".
  • "UC004: ".

UC004: ( )

:

  • .
  • .

:

  • , .
  • " "

UC004-E1:

:

  • ().
  • . [ ]

UC004-E2: .

:

  • () .
  • . [ ]

UC004: ( )

:

  • , , . , UC001.
  • , . , UC002.
  • " "

UC004 > UC001:

:

  • UC001
  • , . UC004 # 2
  • , .

UC004 > UC002:

:

  • UC002
  • , UC004 # 3
  • , .
+2

, , , , " / " : " " " ".

" " .

, .

, , / .

:

: " "

  • .

  • .

  • .

  • " ".

A:

.1. " " .

.2. .

.3. .

. 4. " " .

?

, View iOS, View VIPER. . "". UIViewController View. , .

, iOS View iOS-. iOS , ViewModels. , Presenter SDK iOS, TDD Unit , .

, Presenter View ViewController, Interactor Presenter. , Interactor. Interactor Presenter. , Interactor (Use case) , - .

, Interactor. , .

CreatePlaceInteractor :

CreatePlaceWithManualDataEntryResult createPlaceWithManualDataEntry(CreatePlaceWithManualDataEntryRequest)

CreatePlaceWithCameraAndLocationServiceResult createPlaceWithCameraAndLocationService(CreatePlaceWithCameraAndLocationServiceRequest)

/:

  • CreatePlaceChoicePresenter/View NavigationController Wireframe, , Presenter/View .

  • CreatePlaceWithManualDataEntryPresenter/View CreatePlaceWithManualDataEntry ViewModel CreatePlaceWithManualDataEntry CreatePlaceWithManualDataEntry , .

  • CreatePlaceWithCameraAndLocationServicePresenter/View CreatePlaceWithCameraAndLocationService ViewModel CreatePlaceWithCameraAndLocationService createPlaceWithCameraAndLocationService , .

, , , .

+1

VIPER - , " " iOS

  • , - , ViewController?

  • , MapViewController PlacesInteractor CurrentLocationInteractor ?

Interactor. "". "" "", MapPlaceManager/MapPlaceService, , :

canCreateMapPlace
createMapPlace(Details)

getMapPlaceCount
getMapPlaceIDs
getMapPlaceDetails(ID)

canUpdateMapPlace
updateMapPlace(ID, NewDetails)

, , API- , , Interactor, , Interactor. API-, , // , , , . - - /. .

/ - , . , , . -, , , .

, , MapPlaceView MapPlaceEditView, , . , . . , ViewController/Presenter "" "Create, View, Edit" - . , . Front-End .

, , "" . MainMapPlacePresenter/ViewController 3 - , . . , .

CurrentLocationInteractor : 1. " " 2. " ". , Interactor. Front-End. SaveAuthorizationInteractor . . , Interactors , , .

The host does all the user-speaking and decision-making work — they can use the device APIs if they need to, for example. Location service. You can create an abstract interface ILocationServiceand shell implementation, called one LocationService, that will absorb the user's location service - a low-level implementation and platform-specific details.

In terms of implementation: you can:

MainPresenter/MainViewController
On Load - Show MapView along with Buttons for Edit and Create Map Place

MapPresenter/MapViewController
On Load - Show Map
    Navigations - login, authorization, create, edit
    Interactions - none

MapPlaceCreatePresenter/MapPlaceCreateViewController
    On Load - call MapPlaceCreateInteractor.canCreateMapPlace - Response = {AllGood, UserNotLoggedIn, LocationIsNotAuthorized}
    Interaction - MapPlaceCreateInteractor.createMapPlace - Responses = {PlaceCreatedSuccessfully}
    Navigations - Login, Location Authorization, Back to Main View (With Response - UserLoginNeeded, UserAuthorizationForLocationAccessNeeded)

MapPlaceUpdatePresenter/MapPlaceUpdateViewController
    On Load - call MapPlaceUpdateInteractor.canUpdateMapPlace
    Interaction - MapPlaceUpdateInteractor.updateMapPlace(ExistingMapPlaceID, NewDetails) - Responses = {PlaceUpdatedSuccessfully}
    Navigations - Login, Location Authorization, Back to Main View (With Response - UserLoginNeeded, UserAuthorizationForLocationAccessNeeded)
+1
source

All Articles