Use Case Diagram Tutorial (Guide With Examples)
Use Case Diagram Tutorial (Guide With Examples)
with Examples )
19 February 2015
Use case diagram is a behavioral UML diagram type and frequently used to
analyze various systems. They enable you to visualize the different types of
roles in a system and how those roles interact with the system. This use case
diagram tutorial will cover the following topics and help you create better use
cases.
Actor
Use case
System
Package
Actor
Actor in a use case diagram is any entity that performs a role in one given
system. This could be a person, organization or an external system and
usually drawn like skeleton shown below.
Use Case
A use case represents a function or an action within the system. Its drawn
as an oval and named with the function.
System
System is used to define the scope of the use case and drawn as a
rectangle. This an optional element but useful when your visualizing large
systems. For example you can create all the use cases and then use the
system object to define the scope covered by your project. Or you can even
use it to show the different areas covered in different releases.
Package
When it comes to drawing use case diagrams one area many struggle 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.
Checkout 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 an
other actor. The descendant inherits all the use cases of the ancestor. The
descendant have one or more use cases that are specific to that role. Lets
expand the previous use case diagram to show the generalization of an actor.
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 the
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.