Lecture 6 - UML Sequence and State Diagrams Flashcards
(21 cards)
What are UML Class Diagrams?
UML Class Diagrams describe the static structure of the system
– classes,
– class attributes,
– associations between classes,
– association roles and multiplicity
Cinema Booking Example
REFER TO SLIDES
What do Sequence Diagrams represent?
Sequence diagrams represent
- the interaction of participants (horizontally)
- over time (vertically)
- using messages to communicate
What are Sequence Diagrams?
- Sequence diagrams represent the interaction of objects (horizontally) over time (vertically).
*Showing how the behaviour of a use case is distributed amongst its participating objects allowing developers to find missing objects or resolve uncertainties
What are the most important components in Sequence Diagrams?
1.The participating objects – what are the objects associated with the use case in consideration
2.The flow of events between these objects – what are the messages that might be sent from the sender object to the receiver objects?
What are the conventions for Sequence Diagrams?
Layout
Object Creation
Object Access
What are the conventions for Sequence Diagrams - Layout?
Layout:
1st column: corresponds to the actor who initiated the use case
2nd column: Should be a boundary object with which the actor interacts to initiate the case
3rd column: Should be the control object that manages the rest of the use case
4th column: An entity object representing long-lived info tracked
What are the conventions for Sequence Diagrams - Object Creation?
Object Creation:
– Control objects are created by boundary objects initiating the use case
– Other boundary objects are created by control objects
What are the conventions for Sequence Diagrams - Object Access?
Object Access:
– Entity objects are accessed by control and boundary objects,
– Entity objects should never access boundary or control objects:
This makes it easier to share entity objects across use cases
and makes entity objects resilient against technology-induced
changes in boundary objects.
Order Pricing Example
REFER TO SLIDES
Create New Online Library Account EXAMPLE
REFER TO SLIDES
When do you use Sequence Diagrams?
- You should use sequence diagrams when you want to look at the behavior of several objects within a single use case.
- Sequence diagrams are good at showing collaborations among the objects;
- they are not so good at precise definition of the behavior.
What are State Diagrams?
- A UML state diagram is a notation for describing the sequence of states an object goes through in response to external events.
- UML state machines are extensions of the finite state machine model.
- A state is a condition satisfied by the attributes of an object.
- An event is a potential trigger for a change of state
What is a transition?
Indicates a move from one state to another
What do State Machine Models show?
Show how individual objects change their state in response to events.
REFER TO SLIDES FOR DIAGRAMS
In the context of behaviour modelling, 2 different characterizations of states must be considered, what are they?
- the state of each class, and
- the state of the system as observed from the outside as the system performs its function
What are Statechart Diagrams?
- Graphs whose nodes are states and whose directed arcs are transitions labelled by events.
- States capture conditions which hold for a period of time
- Events change the state (except internal)
- Statechart diagrams represent behaviour from the perspective of a single object only– An object model with a set of objects must be represented by a set diagrams
What is a state and what are its characteristics?
A state is a condition satisfied ny the attributes of an object
Example: State of a user interface screen
* logged in, logged out, active, idle
* active is an abstraction of all the user’s logged in activity
* State has duration
What is an Event?
- Something that happens at a point in time (e.g. button press, mouse click)
- Triggers a transition– Internal transition (no state change)– External transition (change to different state)
- May result in an action being executed
State Chart Diagram vs Sequence Diagram
- State diagrams help to identify:
– Changes to objects over time - Sequence diagrams help to identify
– The relationships between objects over time
– Sequence of operations as a response to one or more events
When do you use state diagrams?
- State diagrams are good at describing the behavior of an object across several use cases.
- State diagrams are not very good at describing behavior that involves a number of objects collaborating.