Use Case Diagram Tutorial (Guide With Examples)
Use Case Diagram Tutorial (Guide With Examples)
Use Case Diagram Tutorial (Guide With Examples)
Examples )
Updated on: 21 February 2022
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
System
The system is used to define the scope of the use case and drawn as a
rectangle. This an optional element but useful when you’re 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
We have covered all these relationships in a separate blog post that has
examples with images. We will not go into detail in this post but you can check
out relationships in use case diagrams.
Identifying Actors
Actors are external entities that interact with your system. It can be a person,
another system or an organization. In a banking system, the most obvious
actor is the customer. Other actors can be bank employee or cashier
depending on the role you’re trying to show in the use case.
Now it’s time to identify the use cases. A good way to do this is to identify
what the actors need from the system. In a banking system, a customer will
need to open accounts, deposit and withdraw funds, request check books and
similar functions. So all of these can be considered as use cases.
Top level use cases should always provide a complete function required by an
actor. You can extend or include use cases depending on the complexity of
the system.
Once you identify the actors and the top level use case you have a basic idea
of the system. Now you can fine tune it and add extra layers of detail to it.
Look for common functionality that can be reused across the system. If you
find two or more use cases that share common functionality you can extract
the common functions and add it to a separate use case. Then you can
connect it via the include relationship to show that it’s always called when the
original use case is executed. ( see the diagram for an example ).
There may be instances where actors are associated with similar use cases
while triggering a few use cases unique only to them. In such instances, you
can generalize the actor to show the inheritance of functions. You can do a
similar thing for use case as well.
One of the best examples of this is “Make Payment” use case in a payment
system. You can further generalize it to “Pay by Credit Card”, “Pay by Cash”,
“Pay by Check” etc. All of them have the attributes and the functionality of
payment with special scenarios unique to them.
There are some functions that are triggered optionally. In such cases, you can
use the extend relationship and attach an extension rule to it. In the below
banking system example “Calculate Bonus” is optional and only triggers when
a certain condition is matched.
Extend doesn’t always mean it’s optional. Sometimes the use case connected
by extending can supplement the base use case. The thing to remember is
that the base use case should be able to perform a function on its own even if
the extending use case is not called.
Use Case Diagram Templates
We’ve gone ahead and created use case diagram templates for some
common scenarios. Although your problem or scenario won’t be exactly like
this you can use them as a starting point. Check out our use case diagram
templates.