includeumlextendsuse-caseuse-case-diagram

Use case extends or include


I have 3 actors: User A, User B and Admin and the use case view photo that is linked with each actors. Now, I want to add a use case add to favourites, and this use case can be activated only by User A.

Should the use case add to favourites extends or include View Photo? The User A goals are view photo and add photo to favourites after view it, if he wants. What is the best solution?


Solution

  • The question is whether add to favourite is a use case at all. Indeed, this looks more like a feature in the user interface of the photo viewer than a user goal on its own.

    If you think it is, and given your narrative, then «extends» seems to be more suitable since it adds some optional behavior to the behavior of viewing the photo. A constraint on the extension point could limit the extension to only some kind of actors.

    A better option in my view would be to make manage favourites a separate use case. Indeed, id yiu think that the favourites are an important goal, then give it the right visibility. How this goal is implemented in the user interface (a use-case is not a user interface !!) is not important, and you could easily show that only one kind of actors is associated with it.

    This being said your diagram will anyway be more ambiguous than you think: when several actors are associated with the same use case it is unspecified if all the actors are involved at the same time (ex: the seller and the buyer in an auction), or if the actors intervene successively in the execution of a use case (e.g one actor completes some operations started by anither actor), or if it means that only one of the actors is involved.