UML - Behavioral Diagrams - 1
UML - Behavioral Diagrams - 1
However, this definition is too generic to describe the purpose, as other four diagrams (activity, sequence,
collaboration, and Statechart) also have the same purpose.
We will look into some specific purpose, which will distinguish it from other four diagrams.
Use case diagrams are used to gather the requirements of a system including internal and external influences.
These requirements are mostly design requirements. Hence, when a system is analyzed to gather its functionalities,
use cases are prepared and actors are identified.
When the initial task is complete, use case diagrams are modelled to present the outside view.
Actors
Actor is an external entity, any “object” or person
that has behavior associated with it.
You can picture an actor as a user of the IT system.
Generally, the users are actors but often systems can
be actors as well. Actor names should not
correspond to job titles.
Ticket vending machine allows commuters to buy
tickets. So Commuter is our actor in this case.
Customer is an actor for the money vending
machine.
UML - Use Case Diagrams
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.
Use Case
Use cases represent the activities that actors perform with the help of your system
in the pursuit of a particular goal.
We need to define what those users (actors) need from the system.
Use case should reflect user needs and goals, and should be initiated by an actor.
Business actor Customer participating in the business use case should be
connected to the use case by association.
UML - Use Case Diagrams
The ultimate goal of the customer in relation to our money vending machine is to
withdraw money.
So we are adding Withdrawal use case.
Withdrawing money from the vending machine might involve a bank for the
transactions to be made.
So we are also adding another actor – Bank. Both actors participating in the use case
should be connected to the use case by association.
Money vending machine provides Withdrawal use case for the customer and Bank
actors.
UML - Use Case Diagrams
Relationships between Actors and Use cases
Use cases could be organized using following relationships:
Generalization
Association
Extend
Include
Extend
There are some functions that are triggered optionally. In such cases the extend relationship is used and the
extension rule is attached to it. 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.
Extend relationship is shown as a dashed line with an open arrowhead directed from the extending use
case to the extended (base) use case. The arrow is labeled with the keyword «extend».
Include
It is used to extract use case fragments that are duplicated in multiple use cases. It is also used to simplify
large use case by splitting it into several use cases and to extract common parts of the behaviors of two or
more use cases.
Include relationship between use cases which is shown by a dashed arrow with an open arrowhead from
the base use case to the included use case. The arrow is labeled with the keyword «include».
Use cases deal only in the functional requirements for a system. Other requirements such as business rules,
quality of service requirements, and implementation constraints must be represented separately.
UML - Use Case Diagrams
The diagram shown below is an example of a simple use case diagram with all the elements
marked.
UML - Use Case Diagrams
Basic Principles for Successful Application of Use cases
Keep it simple by telling stories
Be productive without perfection
Understand the big picture
Identify reuse opportunity for use cases
Focus on value
Build the system in slices
Deliver the system in increments
Adapt to meet the team’s needs
Message flow means the sequence of control flow from one object to
another. Structural organization means the visual organization of the
elements in a system.
The number indicates how the methods are called one after another.