Session 7 Dynamic Model
Session 7
Dynamic Model
OOAD with UML / Session 7 / 2 of 25
Review Use Cases bring out the users of the
system Use Case Diagrams help to define the
roles of actors The services and interaction between
users is described using Use Case Diagrams
Very often these are the first diagrams to be drawn while modeling a system
OOAD with UML / Session 7 / 3 of 25
Objectives Discuss state diagram Explain sequence diagram Work with collaboration diagram
and activity diagram Explain the definitions of dynamic
diagrams in UML
OOAD with UML / Session 7 / 4 of 25
Message and Message Notations
Message is drawn as a line with an arrow between sender and receiver of the message. The arrowhead indicates the type of the message sent
OOAD with UML / Session 7 / 5 of 25
State Diagram State diagrams are one set of diagrams which helps to
draw the dynamics of a system The state of an object at any point in time is the
condition of the object at that instant State of the object is defined by all the attributes of
the object and the links maintained by it
OOAD with UML / Session 7 / 6 of 25
State and Transition The process of change in state is
called state transition Transitions are typically the result of
the invocation of an operation that causes an important change in state
An action is something, in the case of a class it is an operation, which is invoked by/on the entity being modeled
OOAD with UML / Session 7 / 7 of 25
Sub-state-1 The state of an object can have
sub-states in it A sub state is a part of the
composite state Sub States can be concurrent or
sequential
OOAD with UML / Session 7 / 8 of 25
Sub-state-2
OOAD with UML / Session 7 / 9 of 25
Use state diagram
OOAD with UML / Session 7 / 10 of 25
Sequence Diagram Illustrate interaction between
objects; that is the messages sent and received between the objects
Have two axes Vertical axis shows the time,
where as the horizontal axis shows a set of objects
OOAD with UML / Session 7 / 11 of 25
General Sequence Diagram-1
Events are depicted by horizontal lines
Objects by Vertical Lines Time is depicted vertically starting
from top. This means that the events should be depicted in the order in which they occur from top to bottom.
OOAD with UML / Session 7 / 12 of 25
General Sequence Diagram-2
: Customer : Interface : Vendor
Input Coin
Verify Coin
Reject Faulty Coin with Message
Send Genuine Coin
Vend Tea
OOAD with UML / Session 7 / 13 of 25
Recursion
Repetition of the same activity again and again until a condition is met
While showing recursion the event arrow comes back to the same object from where it started
OOAD with UML / Session 7 / 14 of 25
Use Sequence Diagram
OOAD with UML / Session 7 / 15 of 25
Collaboration Diagram-1
Describes interaction between objects just like the Sequence diagram but unlike the Sequence diagram the primary focus is on events
Objects are shown using the Class icon Sequence in Collaboration diagram is
shown by numbering the messages Better for understanding all the effects
on a given object and for procedural design
OOAD with UML / Session 7 / 16 of 25
Collaboration Diagram-2
OOAD with UML / Session 7 / 17 of 25
Activity Diagram-1 To capture action (work) when the
operation is executing. This is the most common usage.
To describe how interactions between related objects take place
To describe a Use-Case’s performance in terms of actions and object state changes.
To capture internal process of an object To describe the functional flow of the
system in terms of objects
OOAD with UML / Session 7 / 18 of 25
Activity Diagram-2
OOAD with UML / Session 7 / 19 of 25
Activity Diagram-3
OOAD with UML / Session 7 / 20 of 25
Activity diagram Concurrency
Concurrency paths run at the same time and then join below The split and merge are represented as solid horizontal lines
OOAD with UML / Session 7 / 21 of 25
Signal-1
Sending a signal
Receiving a signal
Signals Indicate input and output events
The symbol for sending a signal is a convex pentagon. The symbol for receiving a signal is a concave pentagon.
OOAD with UML / Session 7 / 22 of 25
Signal-2
OOAD with UML / Session 7 / 23 of 25
Swimlanes
OOAD with UML / Session 7 / 24 of 25
Use Activity Diagram
OOAD with UML / Session 7 / 25 of 25
Summary State diagrams depict the dynamics of a system
State diagrams can have concurrent or sequential sub states
Sequence diagrams depict the interaction amongst objects. They might contain recursion.
Interaction between objects is shown using Collaboration Diagram
Activity Diagrams capture the activities and their results
Swimlanes simplify the activity diagram and help in understanding the distribution of activities amongst the objects