download

Matakuliah
Tahun
Versi
: M0086/Analisis dan Perancangan Sistem Informasi
: 2005
:5
Pertemuan 23
Sequence Diagram
1
Learning Outcomes
Pada akhir pertemuan ini, diharapkan mahasiswa
akan mampu :
• Mahasiswa dapat Menerangkan Sequence
Diagram (C2)
• Mahasiswa dapat Membuat diagram / skema
Sequence (C4)
2
Outline Materi
•
•
•
•
•
Konsep dasar dan Notasi
Time Constrains
Branching and Recursion
Dialoque Management (Interface Classes)
Modelling real-time systems and
concurrency
3
What is Sequence Diagram?
• Sequence Diagram is a dynamic model of a use
case, showing the interaction among classes
during a specified time period.
• Sequence Diagram is used primarily to show the
interactions between objects in the sequential
order that those interactions occur.
• Illustrates how objects interacts with each other.
• Emphasizes time ordering of messages.
• Can model simple sequential flow, branching,
iteration, recursion and concurrency.
4
What is Sequence .. (Cont’s)
• Illustrates how objects interacts with each
other.
• Emphasizes time ordering of messages.
• Can model simple sequential flow,
branching, iteration, recursion and
concurrency.
5
Elements of Sequence Diagram
Notasi Object
Nama Object
Object
Lifeline
Activation
6
Elements of (Con’t…….)
Notasi
Actor
Actor
Name
Actor (Initiator)
Actor Lifeline
Actor Activation
7
Elements of (Con’t…….)
Notasi Bentuk Panah
• filled solid arrowhead
– Procedure call or other nested flow of control. The entire nested
sequence is completed before the outer level sequence resumes.
– The arrowhead may be used to denote
• ordinary procedure calls, but it may also be used to denote
• Concurrently active instances when one of them sends a Signal and
waits for a nested sequence of behavior to complete before it
continues.
• stick arrowhead
– Message ; that is, no nesting of control. The sender dispatches the
Stimulus and immediately continues with the next step in the
execution.
• dashed arrow with stick arrowhead
– Return from procedure call.
8
Elements of (Con’t…….)
X-Axis (objects)
Actor
Synchronous
message
:A
:B
Procedure
Call
Y-Axis (time)
Asynchronous
message
Return
 Synchronous message : the caller has to wait for the receiving object to
complete execution of the called operation before it can resume execution.
 Asynchronous message : The caller can execute immediately after sending the
message, it does not has to wait for the recipient to handle the message
9
Control information
• Condition
– syntax: ‘[‘ expression ’]’ message-label
– The message is sent only if the condition is true
– example:
• Iteration
– syntax: * [ ‘[‘ expression ‘]’ ] message-label
– The message is sent many times to possibly multiple
receiver objects.
:CompoundShape :Shape
draw()
*draw()
10
Recursion in SD
:A
Recursive
11
Object Creation
• An object may create another object via a
<<create>> message
:A
<<create>>
:B
Object Contruction
(Object Creation)
Object Destruction
(Object Deletion)
12
Branching
• A branch is shown
by multiple arrows
leaving a single
point, each
possibly labeled by
a condition.
• Depending on
whether the
conditions are
mutually exclusive,
the construct may
represent
– conditionality or
– concurrency.
:B
:A
:C
[Gaji >= PKP] Hitung Pajak()
[Gaji < PKP] Hitung Gaji Bersih()
13
Contoh
Berdasarkan Use Case Diagram ini kita
akan membuat Sequence Diagram
dan hasilnya adalah sebagai berikut
14
Contoh Pembuatan PO
Dari Sequence Diagram ini dapat
Dilihat bentuk dari Class Diagramnya
15
To be ConTinue…..
16
Object
• Object dalam Sequence Diagram digambar dengan segiempat
yang berisi nama Object yang diberi garis bawah.
– syntax: [Obiect Name][:className]
– Object dapat diberi nama berdasarkan :
• Nama Object saja
• Nama Class Saja
:Matakuliah
OOAD
• Gabungan Nama Class dan Nama Object
OOAD:Matakuliah
Back
17
Lifeline
• Tiap obyek juga mempunyai Lifeline
(Biasa disebut juga dengan Timeline /
Garis Waktu) yang direpresentasikan
dengan garis putus-putus dibawah
obyek
• Lifeline menggambarkan waktu selama
Obyek yang diatas bisa berhubungan
dengan obyek lain didalam use case.
Back
18
Activation
• Activation digambarkan dengan bentuk
empat persegi panjang sempit yang
menutupi Lifeline.
• Activation menunjukkan kapan sebuah
object mengirim atau menerima
message.
Back
19
Messages
• An interaction between two objects is performed as a
message sent from one object to another (simple
operation call, Signaling, RPC)
• If object obj1 sends a message to another object obj2
some link must exist between those two objects
(dependency, same objects)
• A message is represented by an arrow between the life
lines of two objects.
– Self calls are also allowed
– The time required by the receiver object to process the message
is denoted by an activation-box.
• A message is labeled at minimum with the message
name.
– Arguments and control information (conditions, iteration) may be
included.
20