1. UNIT I UML DIAGRAMS
Introduction to OOAD – Unified Process –
UML diagrams – Use Case – Class Diagrams–
Interaction Diagrams – State Diagrams –
Activity Diagrams –
Package, component and Deployment Diagrams.
3. Introduction
• Interaction diagrams model the behavior of use cases
– By describing the way groups of objects interact to complete the task.
• The diagram shows
1. Objects involved in the use case
2. Messages that are passed b/w these objects within the use case.
• Purpose of Interaction Diagram
– To capture dynamic behaviour of a system.
– To describe the message flow in the system.
– To describe structural organization of the objects.
– To describe interaction among objects.
4. Types of Interaction Diagrams
• Two major kinds of interaction diagrams
1. Sequence Diagram Show the sequence of events that occur.
2. Collaboration Diagram Demonstrate how objects are statically connected
• Sequence diagram emphasizes on
– Time sequence of messages
• Collaboration diagram emphasizes on
– Structural organization of the objects that send and receive messages.
5. Sequence Vs Collaboration
• Main differences :
– Sequence diagrams show time-based object interaction
– Collaboration diagrams show how objects associate with each other.
• If the time sequence is important then sequence diagram is used
• If organization is required then collaboration diagram is used.
6. When to Use: Interaction Diagrams
• Interaction diagrams
– Used when you want to model the behavior of several objects in a use case.
– Demonstrate how the objects collaborate for the behavior.
– Do not give in depth representation of the behavior
• Things to be identified before drawing the interaction diagram:
– Objects taking part in the interaction.
– Message flows among the objects.
– Sequence in which the messages are flowing.
– Object organization.
7. Usage of Interaction Diagrams
• To model flow of control by time sequence.
• To model flow of control by structural organizations.
• For forward engineering.
• For reverse engineering.
8. Sequence Diagram
• Sequence Diagram models the collaboration of objects based on a time sequence.
• It shows how the objects interact with others in a particular scenario of a use case.
• This SD shows a simple scenario for the use of an automatic teller machine.
A constraint specifies 10
seconds as the max.
acceptable time interval
for the transaction.
9. • Sequence diagram
having 4 objects
1. Customer
2. Order
3. SpecialOrder
4. NormalOrder
Sequence Diagram – Example
Time sequence of message flows :
First call is sendOrder()
Next call is confirm ()
Last call is Dispatch ()
This diagram has shown the message sequence for SpecialOrder object
Same can be used in case ofNormalOrder object.
10. Consider a Use Case
• Order Entry window sends a "prepare" message to an Order.
• Order then sends "prepare" to each Order Line on the Order.
• Each Order Line checks the given Stock Item.
– If this check returns "true"
• Order Line removes the appropriate quantity of Stock Item from stock, and
• Creates a delivery item.
– If the Stock Item has fallen below the reorder level,
• That stock Item requests a reorder.
11. Consider a Use Case
vertical rectangles
show the objects activation
vertical dashed lines
represent the life of the object.
Message is shown by an arrow
b/w the lifelines of 2 objects
Message is
labeled
with the
message name
One can include the arguments &
control information in message
Self-call Message that an
object sends to itself
Condition Marker show that
The message is sent
only if the condition is true
Iteration marker shows that a message is
sent many times to multiple receiver objects
12. Return indicates
a return from a message
Returns differ from the
regular messages in that the
line is dashed
On sequence diagram,
Arrows indicate the
messages sent
within the given use case
Consider a Use Case
X represents when the object is destroyed.
13. Asynchronous Message
• An asynchronous message
– Does not block the caller, so it can carry on with its own processing.
• An asynchronous message can do one of three things
1. Create a new thread, in which case it links to the top of an activation
2. Create a new object
3. Communicate with a thread that is already running
14. Transaction Coordinator
coordinate the checking
of the Transaction
Each Transaction Checker object is
responsible for a particular check.
Coordinator creates a number of
Transaction Checker objects
Each checker is called asynchronously
and proceeds in parallel.
When a Transaction is created,
it creates a Transaction Coordinator
When a Transaction Checker
completes, it notifies the
Transaction Coordinator.
Consider a Use Case
15. Textual descriptions
of what's happening
is given along the left
side of the sequence
diagram.
Objects can self-destruct
(last fig),
or
They can be destroyed
by another message
(This figure)
16. Collaboration Diagram
• Collaboration diagrams
– Shows the objects and their association with other objects in the system apart
from how they interact with each other.
– i.e., show the message flow between objects in an OO application
• Association between objects is not represented in a Sequence diagram.
17. Notations
• Objects are shown as icons
• Interaction between the objects is denoted by arrows.
• Message sequence is indicated by some numbering technique
– Number indicates how the methods are called one after another.