A Class Diagram provides an
overview of a system by showing its classes and the relationships among them.
Class diagrams are static - they display what interacts, but not what happens
when they do interact.
Object
Diagrams
show instances instead of classes. They are useful for explaining small pieces
with complicated relationships, especially recursive relationships. Objects are
indicated by placing the name of the object (instance name) to the left of the
class name and separating the two names by a colon. Object names are typically
underlined in a UML diagram to visually help in distinguishing them from
classes (e.g. anObject:ClassA).
UML Statechart Diagram (STD)
•
Shows
the sequences of states that objects of a class go through during its life
cycle in response to external events and also the responses and actions in
reaction to an event.
•
Model
elements
–
States
–
Transitions
–
Events
–
Actions
and activities
STD Elements
•
A
Event - is a significant or noteworthy occurrence
–
e.g.
a phone receiver is taken off the hook
•
A
State - is the condition of an object at a moment in time
- the time between events.
–
e.g.
a phone is in the state of being “idle” after the receiver is placed on
the hook until it is taken off the hook.
•
A
transition - is a relationship between two states that indicates that when an
event occurs, the object moves from the prior state to the subsequent state.
–
e.g.
when the the event “off hook” occurs, transition the phone from the “idle”
to “active” state.
Event Types
•
External
Event (also known as system event)
–
is
caused by something outside the system boundary
–
e.g.
when a cashier presses the “enter item” button on a POST, an external event has
occurred.
•
Internal
Event
–
is
caused by something inside our system boundary.
–
In
terms of SW, an internal event arises when an operation is invoked via a
message sent from another internal object. (The messages in collaboration
diagrams suggest internal events)
•
Temporal
Event
–
is
caused by the occurrence of a specific date and time or passage of time.
State
•
Abstraction of attribute values and links of an
object
•
Sets of values are grouped together into a state
•
Corresponds to the interval between two events
received by the object
–
events represent points in time
–
states represent intervals of time
–
Has duration
–
Often associated with a
–
continuous activity
–
value satisfying some condition
–
Event separates two states
–
State separates two events
State Diagram
•
Graph relating events and states
•
Nodes are states; arcs are events
•
Describes behaviour of a single class of objects
•
Can represent
–
one-shot life cycles
–
continuous loops
•
Continuous loop
–
graph is a loop
–
no definite start state
–
not concerned about how the loop starts
Transition
A transition is a
relationship between two states indicating that an object in the first state
will, when a specified set of events and conditions are satisfied, perform
certain actions and enter the second state. A transition has:
Transition Components
–
a
source state
–
an
event trigger
–
an
action
–
a
target state
Transition Actions, Guard Conditions
•
Transition
Actions
–
a
transition can cause an action to fire. In SW, this may represent the
invocation of a method of an object
•
Transition
Guard conditions
–
a
transition may also have a conditional guard -- or boolean test. The transition
is only taken if the test passes.
Nested State Diagrams
•
State diagrams can get complex
•
For better understanding and management
•
A State in a state diagram can be expanded into
a state diagram at another level
•
Inheritance of transitions
No comments:
Post a Comment