Question 1

All participants in a sequence diagram must match a class in class diagram?

Question 2

All class that represents some object that is created by the system needs a class that creates it?


I'm modelling a system (exercises) for automatic ticketing for bus transport that have these "requisites":

  • (registration) Everyone want to use the automatic ticketing service must register to it, providing general information (name, surname, etc.) and a telephone number on which the cost of tickets will be charged.
  • (generate ticket) When an user wants a ticket, send a message at the service via SMS, and the system has the task to generate an e-ticket, that contains general information about ticket, like date and time of emission and a code that should be shown to the ticket inspector.
  • (control validity) The system must allow a ticket inspector to control the validity of an e-ticket by the code and compare the data of the user to whom it is associated with a document provided by the user.

Now for this domain, I make this simplified class diagram:


Now I need to represent a sequence diagram for a use case buyTicket in which the actor is the user. In this sequence diagram I need to represent a "system" participant with which the user communicates, but it isn't in the class diagram.

So I need to make a class that acts like a service between user and the creation of e-ticketing or I can use participant in sequence diagram that aren't in the class?

Thank's in advance!

3 Answers 3


You are missing a class that creates and issues a ticket on demand. That is what your use case teaches you: you get stuck because your model is incomplete. So you know what to do.

  • Thank's, so now I create a "ticketService" class, associated (bi-directionally) with users and (uni-directionally) with e-Tickets. This class have 1 method createTicket(). now the question is: this service need to be associated only with user and ticket or it can modelling the service made available for the ticketInspector too? but in this way the user would be associated to a class that have method that user should not use. So i don't associate the ticketInspector to the service, but only with the eTicket. Correct in that way?
    – artas
    Sep 8, 2019 at 7:41
  • @artas If the ticket inspector is to verify that a user has a valid ticket it would have no business with the ticket issuer (ticket service). It only needs the ticket and the user it is linked to, if any, to perform the verification. Sep 8, 2019 at 12:50
  • Perfect, this clarify me a lot! In the end I have connected ticketService with user and e-ticket because it have the role of creating e-ticket when an user request one. And have connected ticketInspector directly with user and e-ticket for verify that exits a valid e-ticket with a specific code and that the passenger documents match the user data associated to it. In this way i made easily a sequence for the purchase ticket use case and even for control passengers use case. Thank's!
    – artas
    Sep 8, 2019 at 13:17
  • @MartinMaat, your answer makes sense. But is this your personal preference or do you think that this is required by UML or some other standard? Sep 9, 2019 at 11:26
  • @www It has nothing to do with UML or whatever method or standard. I just noticed the model (the representation of the problem domain) was incomplete. Sep 9, 2019 at 12:55

sequence diagram shows sequence of dialog exchange between to logical stack holders. It doesn't mean that each stack holder will represent a class in your code. It might be a logical group. i.e. your complete program, some class or some package (logical component). In your case there might be 2 stack holders user & system. here system represents your complete application.


Answer to question 1 :

You have assigned the [uml] tag to your question, so I interpret the word "must" in your question as "must according to the latest UML specification". The answer is: No. The UML 2.5.1 specification does not require that all participants in a sequence diagram must match a class modeled in a class diagram.

Answer to question 2 :

No, for the same reason.

You may introduce a TicketService in your sequence diagram without having a class diagram or component diagram that defines such a service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.