0% found this document useful (0 votes)
21 views18 pages

Behavior Modeling Week 5 6

wawaww
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views18 pages

Behavior Modeling Week 5 6

wawaww
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Behavior Modeling

 Sequence Diagrams & State Charts

OOAD
1
• Used to model object interaction arranged in time
sequence and to distribute use case behavior to classes
• Captures the behavior of a single use case scenario
• Shows some example objects and the messages that are
passed between the objects interacting in the use case.

Sequence
diagrams 2
Object Life Line
Active Objects Long dashed line
Actors of any system trailing the object
or any object that is
valid within the
system

Self call

Message
Sent by one object to Activation Bar

Example SD another object. Shows how long the


active object/
Typically method
calls participants are active in 3
the interaction
• Loops are used to indicate looping logic within a model
• Uses interaction frames, which are a way of marking off
a piece of a sequence diagram. These frames have
markers called operators.
• Selections/conditions are used to indicate decision paths
within a sequence diagram
• Also use frames, must be marked with alt operator

More SD Notations:
Loops & selections 4
• Consider the following pseudo code that dispatches
orders in line. The dispatch procedure will differ
depending on their value
Procedure dispatch
foreach (lineitem)
if( product.value > $10K)
careful.dispatch
else
regular.dispatch
end if
end for
if (needsConfirmation)
messenger.confirm
End procedure

Example.. 5
Selection operator
Encloses behavior
that will be followed
based on a certain frame
Loop Frame
condition
Encloses the
behavior that
will be looped
over
Optional Frame
Notice that it does
not have an
Guard alternative operator
Shows the alternative
flow

Sequence diagram with 6

loops & conditions


• When you want to look at the behavior of several objects
within a single use case
• When you want to show collaborations among objects

When to use
Sequence 7

Diagrams
• Example on drawing sequence diagram

8
State chart
diagrams

9
• A state chart diagram shows the sequences of states that
an object can be in, the events and conditions that cause
the object to reach those states, and the actions that take
place when those states are reached.
• Usually modeled for objects and some classes, to depict
how an individual object changes state when its behavior
is changed
• Similar to activity diagrams in notations
• Also called state machine
• State – the object current condition as reflected by the
values in the attributes eg of state
• Cars motor might be running
• Window might be shut or open
• State is therefore a description of something about the
object that will remain true until something happens 10

State charts
• To model object states of a system
• To model reactive system
• To identify events responsible for state changes

Where to use 11

statechart diagrams
State of the compiler
object when project is
loaded 12
• States
• Transitions
• Decision points
• Events
• Actions & Activities
• Synchronization elements

Elements of a 13

statechart diagram
State
-is the condition of an object
at a moment in time
-Shows the state within a
state diagram

Start State
Shows were a
state diagram
starts. End State
Shows were a
state diagram
Transition ends
-Shows that when something
happened, the object moved

State chart from one state to another.


-Shows flow from one state to
another.

elements 14
• An event corresponds to a message sent to the object asking or
telling it to do something
• Atomic (un-interruptible)
• May cause an object to take transition between states
• Notation: eventName(parameter:type,….)
• includes events from hardware and real-world objects e.g.,
message receipt, input event, elapsed time, …
• Actions show the behavior that happens when an event occurs.
• Notation: action-label / action
• Actions alter the object’s attribute values, thus redefining the object’
state. There are five basic action types that a state can initiate:
• Entry use to specify the action that occur when the state has been
entered
• Exit specify actions that occurs when the state is being left
• Do specifies activity that occurs when the while the state is being
occupied

15

Events & Actions


• Used to denote that from a certain state, there could be
many possible transition
• Diamond hollow shape with only one incoming entry
path and two or more exit paths.
Decision Point
Shows that from the main
menu, one can navigate to
any of the given menus and
back to the main menu

16

Decision points
Drawing std

17
• Chapter 9 & 10, UML Bible
• Chapter 10, UML A Beginner’s Guide, By Jason T. Roff

References 18

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy