Date post: | 17-Jan-2016 |
Category: |
Documents |
Upload: | stephen-fleming |
View: | 216 times |
Download: | 0 times |
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 1
Part VI: Design Continuous
Activity DiagamsState Diagrams
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 2
Content Activity Diagams State Diagrams
3
Activity Diagrams
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 4
Activity Modeling a specialized type of behavioral
modeling concerned with modeling the activities and responsibilities of elements.
a special form of state machine to model the computations and workflow
Represents the state of execution not states of objects
applied in conjunction with sequence and collaboration modeling
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 5
Activity Diagrams
widely used in analysis to model a use case flow flow between the use cases with no use of classes, objects, etc.
but also in design to model details of operation details of algorithm
Using Activity Diagrams activity diagram can be
attached to any modeling element for the purpose of modeling the behavior of
that element. Activity diagrams are typically attached to
use cases classes interfaces components nodes collaborations operations and methods
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 6
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 7
Action States Operation of Object Oriented systems
a society of objects Elements communicate with one another
each element has the responsibility of reacting to the communications it receives.
An action state processing as an element fulfills a responsibility
Example (the project management system states)
Project Manager Enters Report Criteria Project Management System Generates Report Printer Prints Report
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 8
Types of action states Initial action state
the first action state A final action state
the last action state is shown using “a bull's eye”
An activity diagram may have only one initial action state, but may have any number of final action
states.
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 9
Flow Transitions
shows how action states are ordered or sequenced.
Whenever an action or subactivity state finishes its work,
there is a transition out of the state into the next
state types of flow transitions:
control-flow object-flow transitions
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 10
Control-Flow Transitions indicates
the order of action states Once a source action state
completes its processing, a target action state
starts its processing
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 11
Example Control Flow Transitions
task of generating a report for the project management system
order of action states: The Project Manager Enters Report
Criteria The Project Management System
Generates Report The Printer Prints Report
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 12
Control-flow transitions
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 13
Default transitions Control-flow transitions
are also known as default transitions or automatic transitions,
because they are unlabeled and are immediately triggered
after the source action state completes processing.
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 14
Decisions
A decision involves selecting one control-
flow transition out of many control-flow
transitions based upon a
condition
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 15
Swimlanes a visual region in an
activity diagram Represents
use cases classes components organizational units
in business modeling roles
in workflow modeling indicates the element
has responsibility for action states within
the region
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 16
Object-Flow Transitions Indicates an action
state input or output an
object can modify object
state An object-flow
transition is shown as
a dashed arrow between
an action state and an object. Activities may input and output objects and can modify object
state show this on an activity diagram as an object flow
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 17
Types of Object-Flow Transitions
An action state uses an object as input: show with object-flow transition arrow Point
from the object to the action state.
An action state updates or produces an object: Show with the object-flow transition arrow Point
from the action state to the object
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 18
Control-flow and object-flow transitions
Without unnecessary control-flow transitions
Signals A signal is a way of representing
a package of information that is communicated asynchronously
between two objects.
A signal event occurs when an object receives a signal
When an event is received by an object it may trigger a state transition in it
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 19
Sending & Receiving Signals
the signal called Order is sent to the :MailOrderCompa
ny external object we wait in the
signal receipt for a signal called
Goods delivered
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 20
Signals are classifiers Modeled as stereotyped classes. The purpose of a signal is
to provide asynchronous communication of information
between objects and so, unlike ordinary classes,
they only have attributes and the single implicit operation
send(targetSet) allows them to be sent to a set of target objects. As this operation is implicit,
it is never actually shown on signal diagrams it is just assumed that it is there for every signal.
The signal attributes specify the information content of the signal
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 21
Example: GUI events
a generalization hierarchy of raw GUI events modeled as signals
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 22
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 23
Concurrency selecting multiple transitions simultaneously
24
State Diagrams
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language)
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 25
State Diagrams also known as
statechart diagrams state machines (in UML 2.0)
depict the lifecycle of elements that make up a system
State modeling is a specialized type of behavioral
modeling concerned with modeling
the lifecycle of an element
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 26
States: Definition A state
is a condition of being at a certain time. is drawn as a rounded rectangle
with the name of the state in the center can be
a passive quality, Example: light object=> On and Off.
an active quality (object is doing something Example: Person => moving, sleeping, reading, … Example: coffeemaker => Brewing
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 27
Simple States
indicates a condition or situation of an element.
Example: the project management system
Inactive is not available to its users, because it is not started or has been shut
down Active
started and available to its users Suspended
has encountered some severe error, Possible reason:
is running low on secondary storage requires user intervention
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 28
Initial and Final States
Initial state the state of an element ,
when it is created. is shown with a small solid filled
circle. A final state
the state of an element when it is destroyed.
is shown with a circle surrounding a small solid
filled circle a bull's eye
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 29
Transitions A transition,
shown with an arrow represents
a change of states from a source state to a
target state A transition description,
written along the arrow, describes the
circumstances causing the state change
to occur.
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 30
Trigger A trigger is
an event cause a transition. Example: User input processing systems
a keystroke trigger may cause the system to change states
from Gathering input to Processing input.
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 31
Transition Variations A trigger with no guard
the transition is taken when the trigger occurs.
This is useful for modeling a state change in response to an event.
A trigger with a guard the transition is taken
when the trigger occurs if the guard evaluates to true.
Otherwise, the transition isn't taken.
Combining a trigger and a guard is useful
for modeling a transition is blocked depending on a condition.
Neither a trigger nor a guard are specified,
the transition is taken immediately after the source state's internal
behavior
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 32
The life cycle of an object
the life cycle of an AccountApplication object as it passes from pending to approved or rejected and then to finalizing
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 33
Example how to use
State diagram modeling a troll in a FPS game FPS: first-person shooter
the troll's behavior is determined by his state
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 34
Composite States A composite state is a state
contains one or more state diagrams. Each diagram belongs to a region,
regions are divided by a dotted line A state in a region is referred to as a
substate of the composite state. Composite states work as follows:
when the composite state becomes active, the initial pseudostate of each region becomes
active, and the contained state diagrams begin executing.
if a trigger on the composite state occurs The contained state diagrams are interrupted
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 35
Composite States Example
Composite states contain one or more state diagrams; execute in parallel
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 36
Advanced Pseudostates A choice pseudostate
used to emphasize a Boolean condition determines
which transition is followed. has guards
represented on outgoing transitions the transition depends on the guard.
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 37
Fork and join pseudostates
show branching into concurrent states and then rejoining
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 38
Signals transition-oriented view:
to draw attention to transitions and transition behavior using special icons for transitions.
21.04.23 Object Oriented Analysis & Design & UML (Unified Modeling Language) 39
End of Chapter