Transcript Week 03

CS 2511
Fall 2014
UML Diagram Types

2 Main Types
 Structure Diagrams
○ Class Diagrams
○ Component Diagrams
○ Object Diagrams
 Behavior Diagrams
○ Sequence Diagrams
○ Use Case Diagrams
Sequence Diagrams
A sequence diagram in Unified
Modeling Language (UML) is a kind
of interaction diagram that shows how
processes operate with one another and
in what order.
 In Java most of the interaction between
processes is done via objects, and thus
a sequence diagram basically shows
how objects interact with other objects.

Organization
Object Name:
Class Name
:Class Name
Method Call
Method Call
Object Name
Some Important Points

Each use case can be depicted as a
sequence diagram.

An underline with the class name and/or
object name usually means that the entity
being displayed is an object not a class.
Object

Each box represents an Object that is
alive (i.e. it’s constructor has been
called) at a particular time in the
computation.

3 options to represent objects :
Object Name:
Class Name
:Class Name
Object Name
LifeLines

The time for which an object is “alive”
i.e. still in scope (which means has not
been garbage collected yet) is
represented by a life line.
smallCircle
:Circle
Activation Bars

Activation bars are used to represent the time
when an object is calling a method.

The activation bars ends when the method that
was called returns.
smallCircle
:Circle
myMonitor:
Display
methodCall( )
Returned from method
Call Arrows and Method Names
A call is represented by an arrow going from
one object to another.
 Method Names are represented on the call
arrow.

:BridgeProblem
<<create>>
currentState
:BridgeState
Examples

Code :
public static void main(String[] args)
{
BridgeState initialState = new BridgeState("west",
"west", "west", "west", "west", 0);
BridgeState finalState = new BridgeState("east",
"east", "east", "east", "east", 17);
initialState.display();
finalState.display();
}
Sequence Diagram
<<create>>
BridgeTest1.
main
<<create>>
display()
display()
initialState:
BridgeState
finalState:
BridgeState