use case diagam tutorial

Use Case Diagram Relationships Explained with Examples

When it comes to drawing use case diagrams one area many struggles with is showing various relationships in use case diagrams. In fact many tend to confuse <<extend>>, <<include>> and generalization. This article will look into various use case diagram relationships in detail and explain them using examples. To get a deeper understanding of use cases, check out our use case diagram tutorial. If you want to draw them while learning you can use our tool to create use case diagrams.

There can be 5 relationship types in a use case diagram.

  • Association between actor and use case
  • Generalization of an actor
  • Extend between two use cases
  • Include between two use cases
  • Generalization of a use case

Let’s take a look at these relationships in detail.

Association Between Actor and Use Case

This one is straightforward and present in every online use case diagram tool. Few things to note.

  • An actor must be associated with at least one use case.
  • An actor can be associated with multiple use cases.
  • Multiple actors can be associated with a single use case.
use case diagram relationships for actor and use case

Different ways association relationship appears in use case diagrams

Check out the use case diagram guidelines for other things to consider when adding an actor.

Generalization of an Actor

Generalization of an actor means that one actor can inherit the role of the other actor. The descendant inherits all the use cases of the ancestor. The descendant has one or more use cases that are specific to that role. Let’s expand the previous use case diagram to show the generalization of an actor.

actor generalization use case relationship

A generalized actor in an use case diagram

Extend Relationship Between Two Use Cases

Many people confuse the extend relationship in use cases. As the name implies it extends the base use case and adds more functionality to the system. Here are a few things to consider when using the <<extend>> relationship.

  • The extending use case is dependent on the extended (base) use case. In the below diagram the “Calculate Bonus” use case doesn’t make much sense without the “Deposit Funds” use case.
  • The extending use case is usually optional and can be triggered conditionally. In the diagram, you can see that the extending use case is triggered only for deposits over 10,000 or when the age is over 55.
  • The extended (base) use case must be meaningful on its own. This means it should be independent and must not rely on the behavior of the extending use case.

Lets expand our current example to show the <<extend>> relationship.

use case diagram relationships with extend

Extend relationship in use case diagrams

Although extending use case is optional most of the time it is not a must. An extending use case can have non-optional behavior as well. This mostly happens when your modeling complex behaviors.

For example, in an accounting system, one use case might be “Add Account Ledger Entry”. This might have extending use cases “Add Tax Ledger Entry” and “Add Payment Ledger Entry”. These are not optional but depend on the account ledger entry. Also, they have their own specific behavior to be modeled as a separate use case.

Include Relationship Between Two Use Cases

Include relationship show that the behavior of the included use case is part of the including (base) use case. The main reason for this is to reuse common actions across multiple use cases. In some situations, this is done to simplify complex behaviors. Few things to consider when using the <<include>> relationship.

  • The base use case is incomplete without the included use case.
  • The included use case is mandatory and not optional.

Lest expand our banking system use case diagram to show include relationships as well.

How to use include in use case diagrams

Includes is usually used to model common behavior

For some further reading regarding the difference between extend and include relationships in use case diagrams check this StackOverflow link.

Generalization of a Use Case

This is similar to the generalization of an actor. The behavior of the ancestor is inherited by the descendant. This is used when there is common behavior between two use cases and also specialized behavior specific to each use case.

For example, in the previous banking example, there might be a use case called “Pay Bills”. This can be generalized to “Pay by Credit Card”, “Pay by Bank Balance” etc.

I hope you found this article about use case relationships helpful and useful. You can use our diagramming tool to easily create use case diagrams online. As always if you have any questions don’t hesitate to ask them in the comments section.

Join over thousands of organizations that use Creately to brainstorm, plan, analyze, and execute their projects successfully.

Get started here
Download our all-new eBook for tips on 50 powerful Business Diagrams for Strategic Planning.

Author

Nishadha

Software engineer turned tech evangelist. I handle marketing stuff here at Creately including writing blog posts and handling social media accounts. In my spare time, I love to read and travel.

Comments

  1. Murat Yıldız

    Many thanks for this great tutorial. It is really very clear with good examples and explanation methodology and most probably one of the best UML Tutorial on the web. Hope to come across such kind of good tutorials again…

  2. Kevin

    Great tutorial! It’s probably the best one I’ve read

  3. Nikko

    Does an included use case have to be used everytime the base case is used?

    • Fathur Rizki

      yes it does. the included use case is always be used everytime the base use case used. it’s like when someone’s sneezing he always close his eyes. sneezing is the base use case and closing eyes is the included use case.

  4. #tedd

    is it possible to make extensions within a use case itself.

    • Marek Krótkiewicz

      Yes, “The same extending UseCase can extend more than one UseCase. Furthermore, an extending UseCase may
      itself be extended.” – UML 2.5.1 Specification.

  5. kartik

    Found it better than other tutorials…. explaining everything as part of the development process. Thanks, hope to see other tutorials on OOAD and other topics.

  6. Ashan

    This tutorial helped me to understand the difference between include and extend. Keep it up bro. Good luck!

  7. Dildrave

    Question: There are two sub usecases in a genaralized one. If I want a include to be attached to which one do I attach it. The main Usecase or the sub usecase

  8. Sravanthi

    Awesome article … well and clearly explained all the concepts in use case diagrams

    -thanks

  9. devil

    why use <> in use case?

    • Bilal Ahmed

      In Visual Modeling we model according to some standard. Every shape or sign has a meaning.To draw relationship between Use cases we use to express the type of relationship by mentioning relationship type within . It’s a standard.

  10. Siddharth

    Fantastic. This is the most succinct and precise explanation of use case and their relationships that I have ever come across. Thanks

    • Tanja

      I agree – the best tutorial explaining the relationships that it can truly be understood! Thanks!!

  11. Manjushri

    What is the difference between “Extend” and “Generalization”?

  12. Kunal

    I was preparing for my CBAP exam and this post helped me understand the difference between Extend and Include.
    Thanks.

  13. Abid

    what is diference between use case and use case modeling

    • Bilal Ahmed

      A use case is a functionality performed by an actor(primary,secondary or offstage)
      Use case modeling is a process of drawing use cases in some modeling languages e.g StarUml

  14. Yves RAKOTO

    Nice tutorial, very helpful. Thanks a lot 🙂

  15. Devendra Chauhan

    Awesome Tutorial. now i understood use-case-relationship……..

  16. Isurika Perera

    Super Tutorial….. very very helpful for me to learn about Use Case Diagram……Thank u very much and I have a grate proud about u as a Sri Lankan. Keep up.

  17. Wania

    not generalized but specialised

  18. TRAN bao

    Good tutorial!
    Really helpful for me

Leave a comment

*
*

one × four =

Back to top