0% found this document useful (0 votes)
59 views4 pages

Interaction Diagrams Components: Object

Interaction diagrams like sequence diagrams describe how objects collaborate through messages to implement behavior, focusing here on sequence diagrams. Sequence diagrams show objects arranged vertically and messages passed between them over time to implement a use case or part of one. They can depict conditional messages and iterations. State diagrams describe the states an object can be in and transitions between them in response to events.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views4 pages

Interaction Diagrams Components: Object

Interaction diagrams like sequence diagrams describe how objects collaborate through messages to implement behavior, focusing here on sequence diagrams. Sequence diagrams show objects arranged vertically and messages passed between them over time to implement a use case or part of one. They can depict conditional messages and iterations. State diagrams describe the states an object can be in and transitions between them in response to events.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Interaction Diagrams Components

◆ Describe how groups of objects collaborate in some behavior ◆ Object


• often used to show how use cases or parts of use cases behave • shown as a box at the top of a vertical dashed line anOrderEntry
• Two kinds of interaction diagrams are Window
◆ lifeline
» sequence diagrams
• represents time flow
» collaboration diagrams
◆ We will focus on sequence diagrams Object

lifeline

Components Components
anOrderLine aStockItem
◆ Messages ◆ Two kinds of control information anOrder anOrderLine aStockItem
• communcation between objects • message conditions
» message sent only if condition is
◆ Special message types true
check() Self-delegation * Prepare() Condition
• self-delegation
• iteration marker check()
• return » message sent to multiple receiver
[Check = “true”]
objects remove()
needsToReorder() Iteration
Normal
message

Return

Example Sequence Diagram Tips on Sequence Diagrams

anOrderEntry anOrder anOrderLine aStockItem


Window ◆ Show conditional behavior on separate diagrams
Prepare() ◆ Use to show the behavior of several objects within a use case
* Prepare() • use a state diagram when you want to focus on one object across many use
Object check() Condition cases
Message [Check = “true”]
remove()
Iteration
needsToReorder()

Self-Delegation

[needsToReorder = “true]
new
Return
aReorderItem
Creation

[Check = “true”]
new
aDeliveryItem

1
State Diagrams Components

◆ Describe ◆ States
• the possible states a single object can get in to • represented as a rounded box
• how object changes state in response to events » name
» activities - process performed by object, long-running, interruptible
◆ form1 : do / activityName

◆ form2 : eventName / activityName

• initial state is special, represented as a filled circle

initial state

state

Checking
activity

Do / check item

Components Example State Diagram for Order Object

◆ Transitions
• allowable state change / get first item
[Not all items checked]
• represented as an arrow from one state to another / get next item [all items checked &&
Checking all items available] Dispatching
» form : Event [Guard] / Action
• events can be thought of as signals Do/ initiate
Do / check item delivery
• a guard is boolean condition Item Received
[all items available]
• actions are short-duration, interruptible processes carried out during transitions [all items checked && Cancelled
some items not in stock]
Cancelled

/ get first item


[Not all items checked] Item Received
/ get next item [some items not in stock]
Checking
Waiting
transition
Do / check item
Cancelled Delivered
Cancelled Cancelled
Self-transition

Using Superstates Concurrent State Diagrams

/ get first item

[Not all items checked] Active ◆ Payment authorization done concurrently


/ get next item [all items checked &&
Checking all items available] Dispatching
Do/ initiate [payment not OK]
Do / check item Authorizing
delivery
do / check
Item Received
[all items checked && payment
some items not in stock] [all items available]
[payment OK]
Item Received
[some items not in stock]
Rejected
Waiting Authorized

Cancelled

Cancelled Delivered Delivered

2
Concurrent State Diagram Tips on State Diagrams

◆ Describe behavior of one object, not many objects


• for many objects use interaction diagrams
Waiting Cancelled
◆ Don’t try to draw them for every object
Cancelled

Checking Dispatching

Delivered

Authorizing Authorized

Rejected
[payment not OK]

Activity Diagram Components

◆ Show the flow of a process from activity to activity ◆ Activities


• task that needs to be done

Receive
Order

Components Components

◆ Control flow ◆ Parallelism and synchronization


Receive
• Sequencing Supply • allows parallel threads to be created or destroyed
» temporal ordering of tasks • stops progress until all threads reach synchronization point
» can be guarded
• Decision Choose
» if-then-else construct Outstanding Receive
Order Items Order
» (not shown here)
• Multiple triggers * for each chosen order item
» indeterminate looping construct
Assign Goods
to Order Authorize Check Line
Payment Items

Dispatch
Order

3
Example Activity Diagram Tips on Using Activity Diagrams

Receive ◆ Good for exploring parallel process flows


Order Receive
Supply • analyzing a use case
* for each line item • understanding workflow across multiple use cases
on order • understanding multi-threaded applications
Authorize Check Line
Payment Item
Choose
Outstanding
◆ Poor at showing connections between objects and actions
[failed] Order Items • trying to understand how objects collaborate
[in stock]
• understanding object lifecycle behavior
Assign to
* for each chosen order item
[succeeded] Order
Cancel Assign Goods
Order
to Order
[need to reorder]

Reorder
Item
[all outstanding
order items filled]
[stock assigned to all line
items and payment authorized] Add Remainder
to Stock
Dispatch
Order

You might also like