adstrumm_
adstrumm_

Reputation: 71

How to build sequence diagram with 3 actors?

Overview: This is my activity diagram for the stock management subsystem. I have 3 actors which are the admin, manager, and employee.

Question: Can someone explain to me how can I do my sequence diagram with 3 actors? In my sequence diagram, I need to have interface and controller (primary) not just the entity classes.

Note: I already made the sequence diagram for each of the actors but I don't know how to combine its kinda complicated lol.

activity diagram

Upvotes: 1

Views: 1479

Answers (1)

Christophe
Christophe

Reputation: 73530

Sorry for being provocative, but this is a misunderstanding: actors are by definition external to the system:

UML 2.5.1, section 18.1.3.1: A subject of a UseCase could be a system or any other element that may have behavior, such as a Component or Class. (...)

An Actor models a type of role played by an entity that interacts with the subjects of its associated UseCases. Actors may represent roles played by human users, external hardware, or other systems.

In your activity diagram, you modelled activities of the sytem and grouped those activities in partitions ("swimlanes"). These partitions may somehow be related to actors, but they are not themselves actors. It's just a (visual) grouping:

UML 2.5.1, section 15.6.3.1: An ActivityPartition is a kind of ActivityGroup for identifying ActivityNodes that have some characteristics in common.

Likewise a sequence diagram is meant to represent interactions within the system:

UML 2.5.1, section 17.2.3.1: interactions are units of behavior of an enclosing Classifier.

As a direct consequence, you should in principle not show actors in a sequence diagram, since they are external to the system and not enclosed in the system, a subsystem or a class thereof. It's however a common and tolerated practice (although ambiguous):

  • You could extend this notation and have a lifeline for each actor, but this would remain very ambiguous and would make a very complex interaction diagram. Even more if considering the combinatorial explosion of possible scenarios with so many actors. You have nothing to gain to do so.
  • If you really want actors in a SD, a better approach would be to separate concerns: make one SD diagram per actor, that shows the interactions from the view point of the actor. I understand that you already did this. The activity diagram shows how this fits together. (There is no need to have a giant SD diagrams showing all possible interactions)

Typically, activity diagrams with regions are a convenient way to document workflows with several actors. If you want to really focus on actors in compelx workflows, a better alternative would proabably be to use BPMN, which is designed for business process modeling.

Upvotes: -1

Related Questions