UNIT2_ Behavioral Diagrams
UNIT2_ Behavioral Diagrams
behavioral diagrams
UML behavioral diagrams visualize, specify, construct, and
document the dynamic aspects of a system. The behavioral
diagrams are categorized as follows: use case diagrams,
interaction diagrams, state–chart diagrams, and activity diagrams.
Use Case Model
• Use case
A use case describes the sequence of actions a system performs
yielding visible results. It shows the interaction of things outside
the system with the system itself. Use cases may be applied to the
whole system as well as a part of the system.
Actor
An actor represents the roles that the users of the use cases play. An actor
may be a person (e.g. student, customer), a device (e.g. workstation), or
another system (e.g. bank, institution).
The following figure shows the notations of an actor named Student and a
use case called Generate Performance Report.
Use case diagrams
Use case diagrams present an outside view of the manner the
elements in a system behave and how they can be used in the
context.
Use case diagrams comprise of −
• Use cases
• Actors
• Relationships like dependency, generalization, and association
• System Boundaries
Each system has a predefined boundary and this element shows that on the
diagram. Moreover, this component can also be used to indicate the
system’s different functions, especially if they are targeting different actors.
You can show the system boundary on your use case diagram with a
rectangular shape.
• An include is a relationship that shows that a use case is
mandatory, as well as part of another use case.
• An exclude is a relationship that indicates that the use case is
an option and will take place after the initial use case.
Registration use case is complete and meaningful on its
own.
It could be extended with optional Get Help On
Registration use case.
Checkout use case includes several use cases - Scan Item,
Calculate Total and Tax, and Payment
Use case diagrams are used −
• To model the context of a system by enclosing all the activities
of a system within a rectangle and focusing on the actors
outside the system by interacting with it.
• To model the requirements of a system from the outside point
of view.
Examples
Let us consider an Automated Trading House System. We assume
the following features of the system −
• The trading house has transactions with two types of customers,
individual customers and corporate customers.
• Once the customer places an order, it is processed by the sales
department and the customer is given the bill.
• The system allows the manager to manage customer accounts
and answer any queries posted by the customer.
ATM Machine System
Online shopping system
Railway Reservation System
Interaction Diagrams
Interaction diagrams depict interactions of objects and their relationships.
They also include the messages passed between them. There are two types
of interaction diagrams −
• Sequence Diagrams
• Collaboration Diagrams
Interaction diagrams are used for modeling −
• the control flow by time ordering using sequence diagrams.
• the control flow of organization using collaboration diagrams.
Sequence Diagrams
Sequence diagrams are interaction diagrams that illustrate the
ordering of messages according to time.
• Notations − These diagrams are in the form of two-dimensional
charts. The objects that initiate the interaction are placed on the
x–axis. The messages that these objects send and receive are
placed along the y–axis, in the order of increasing time from
top to bottom.
• Example − A sequence diagram for the Automated Trading
House System is shown in the following figure.
Collaboration Diagrams
• Collaboration diagrams are interaction diagrams that illustrate
the structure of the objects that send and receive messages.
• Notations − In these diagrams, the objects that participate in
the interaction are shown using vertices. The links that connect
the objects are used to send and receive messages. The message
is shown as a labeled arrow.
• Example − Collaboration diagram for the Automated Trading
House System is illustrated in the figure below.
State–Chart Diagrams
A state–chart diagram shows a state machine that depicts the control flow of an object
from one state to another. A state machine portrays the sequences of states which an
object undergoes due to events and their responses to events.
• State–Chart Diagrams comprise of −
• States: Simple or Composite
• Transitions between states
• Events causing transitions
• Actions due to the events
State-chart diagrams are used for modeling objects which are reactive in nature.
Example
• In the Automated Trading House System, let us model Order as an object and trace
its sequence. The following figure shows the corresponding state–chart diagram.
Activity Diagrams
An activity diagram depicts the flow of activities which are ongoing non-atomic
operations in a state machine. Activities result in actions which are atomic operations.
Activity diagrams comprise of −
• Activity states and action states
• Transitions
• Objects
Activity diagrams are used for modeling −
• workflows as viewed by actors, interacting with the system.
• details of operations or computations using flowcharts.
Example
The following figure shows an activity diagram of a portion of the Automated Trading
House System.
• ref,. …
• https://www.uml-diagrams.org/