UNIT-III
Dynamic Diagrams – UML interaction diagrams – System sequence diagram – Collaboration
diagram – When to use Communication Diagrams – State machine diagram and Modeling –
When to use State Diagrams – Activity diagram – When to use activity diagrams Implementation
Diagrams – UML package diagram – When to use package diagrams – Component and
Deployment Diagrams – When to use Component and Deployment diagrams
1. What are System sequence diagram? What is the relationship between SSD and UseCase
?Explain with example.
System Sequence Diagrams
Use cases describe how external actors interact with the software system. During this
interaction an actor generates system events to a system, usually requesting some system
operation to handle the event.
A system sequence diagram (SSD) is a picture that shows, for a particular scenario
of a use case, the events that external actors generate their order, and inter-system
events.
A system sequence diagram should specify and show the following:
External actors
Messages invoked by these actors
Return values associated with previous messages
Indication of any loops or iteration area
Example of an SSD
Relationship between SSDs and Use Cases
Sequence diagram is used to represent one scenario of the use case .Hence it can be derived by
observing the use case.
How to Name System Events and Operations?
Choose event and operation names at abstract level.
Start the name of a system with verb such as add, enter, insert, make etc.
Example:
Guidelines
Following guideline is used while designing the SSD
The sequence diagram generally represents only one scenario of use case model.
System event must be represented at the abstract level.
The system event must be usually a verb. For example display, enter, select, eject and so
on.
The sequence diagram can represent the collaboration with other external systems.
2. Explain with an example, how interaction diagrams are used to model the dynamic
aspects of a system.
Interaction diagram:
Interaction diagram is used to show the interactive behavior of the system.
Two Types of Interaction Diagram
1. Sequence diagram
2. Collaboration diagram
1. Sequence diagram:
A Sequence diagram simply depicts interaction between objects in a sequential order i.e the
order in which these interactions take place.
Basic Notation used in sequence diagram
1. Lifeline boxes
A lifeline represents an individual participant in the Interaction
2. Activation
Activation boxes represent the time an object needs to complete a task.
3. Messages
Messages are arrows that represent communication between objects.
4. Found Message
A message sent from an unknown recipient
5. Lost Message
A message sent to an unknown recipient.
6. Reply or Return Message
A reply message is drawn with a dotted line.
7. Self-Message
A message sent from an object to itself.
8. Create Message
This is a message that creates a new object.
9. Synchronous Message
A synchronous message requires a response before the interaction can continue.
10. Asynchronous Message
Asynchronous messages don't need a reply for interaction to continue.
11. Object Destruction
The X at the bottom of an activation box indicates that the object has been removed.
12. Looping
Iteration or Loop is used to indicate certain operations will be executed ‘n’ number of times.
13. Conditional Messages
The message is only sent if the clause evaluates to true.
14.Mutually exclusive conditional messages
Mutually Exclusive Message indicates that either one of the messages can be passed based on the
condition.
Example:
2. Collaboration diagram
A collaboration diagram shows the objects and relationships involved in an interaction and the
sequence of messages exchanged among the objects during the interaction.
Basic notations in collaboration diagram
1. Link
A link is a connection path between two objects; it indicates navigation and visibility between
the objects.
2. Messages
Each message between objects is represented with a message expression and small arrow
indicating the direction of the message.
3. Messages to "self" or "this"
A message can be sent from an object to itself.
4. Creation of Instances
Any message can be used to create an instance. The create message may include parameters,
indicating the passing of initial values.
5. Message Number Sequencing
The number of message indicates the order of message within an interaction.
6. Conditional Messages
The message is only sent if the clause evaluates to true.
7. Mutually Exclusive Conditional Paths
Mutually Exclusive Message indicates that either one of the messages can be passed on the
condition.
8. Iteration or Looping
Iteration or Loop is used to indicate certain operations will be executed ‘n’ number of times.
Example:
3. Illustrate UML activity diagram with an example
Activity Diagram
Activity diagram is basically a flowchart to represent the flow from one activity to
another activity.
Activity diagram is used to describe the dynamic aspects of the system.
Purpose
Draw the activity flow of a system.
Describe the sequence from one activity to another.
Describe the parallel, branched and concurrent flow of the system.
Basic notations in activity diagram
1.Initial State
A small filled circle followed by an arrow represents the initial action state or the start point for
any activity diagram.
2.Activity or Action State
An activity represents execution of an action on objects or by objects. We represent an activity
using a rectangle with rounded corners.
3.Action Flow
Action flows or Control flows are also referred to as paths and edges. They are used to show the
transition from one activity state to another.
4.Decisions and Branching
When we need to make a decision before deciding the flow of control, we use the decision node.
5.Guards
In UML, guards are a statement written next to a decision diamond that must be true before
moving to the next activity.
6.Fork
A fork node is used to split a single incoming flow into multiple concurrent flows.
7.Join
A join node joins multiple concurrent flows back into a single outgoing flow.
8.Merge
A diamond with several flows entering and one leaving.
9.Final State or End Point
An arrow pointing to a filled circle nested inside another circle represents the ending point.
When to use Activity diagram
Visualize business processes and workflows.
Model work flow by using activities.
Model business requirements.
High level understanding of the system functionalities.
Investigate business requirements at a later stage.
Example:
Explain UML state machine diagram and modeling.
State machine diagram
State machine diagram represents the events and states of object and the behavior of
object in reaction to an event.
State chart diagram shows the life cycle of the object.
Events, states and Transitions
Event
An event is significant occurrence of something.
Example: Customer inserts ATM card.
States
A state is a condition of object at a particular moment of time.
Example: Waiting for user to enter PIN.
Transitions
The relationship between the two states is indicated using the transition.
Example: When the system operator performs startup the transition from idle state to active state
occurs.
Basic notations in state Diagram
More Notations
Guard:
A transition may be condition guard which represents the Boolean test .when the condition
results true then only further state change occurs.
Nested states:
States that contain other states known as Nested states.