際際滷

際際滷Share a Scribd company logo
SEQUENCE DIAGRAM
E. Haodudin Nurkifli
Teknik Informatika
Universitas Ahmad Dahlan
Pertemuan : 6
SEQUENCE DIAGRAM
Merupakan suatu diagram interaksi yang
memodelkan suatu skenario tunggal yang dijalankan
pada sistem
 Digunakan untuk memperlihatkan interaksi antar
obyek dalam perintah yang berurut.
 Tujuan utama adalah mendefinisikan urutan
kejadian yang dapat menghasilkan output yang
diinginkan
SEQUENCE DIAGRAM
Partisipan : obyek atau entitas yang bertindak dalam
sequence diagram
 Message : komunikasi antar obyek partisipan
 Terdapat 2 tipe garis yaitu vertikal dan horisontal


 Vertikal

: waktu  maju berdasarkan waktu
 Horisontal : obyek mana yang beraksi
ELEMEN NOTASI
Didefinisikan pada UML 2.0
 Digambarkan dalam bentuk frame
 Bersifat optional untuk menggambarkan batas grafis
suatu diagram.
ELEMEN NOTASI (CONT.)



A sequence diagram that has incoming and outgoing
messages
ELEMEN NOTASI (LABELING)
DiagramType
DiagramName


The UML specification provides specific text values
for diagram types
 sd

= Sequence Diagram,
 activity = Activity Diagram,
 use case = Use Case Diagram
TYPES OF INTERACTION


Creation




Synchronous




Pesan yang dikirim oleh 1 obyek ke obyek lain dan obyek pertama
menunggu sampai hasil aksi selesai.

Asynchronous




Menunjukkan pesan yang menyebabkan terjadinya pembentukan
instan obyek.

Pesan yang dikirim oleh 1 obyek ke obyek lain dan obyek pertama
tidak menunggu sampai hasil aksi selesai.

Reply


Menunjukkan nilai kembali dari obyek ke obyek yang megirim
pesan

Sumber : schaum outline
GUIDELINES FOR BUILDING A
UML SEQUENCE DIAGRAM
1.
2.
3.
4.
5.

6.

Set the context (i.e. scope the system)
Identify participating objects
Draw arbitrary lifelines for each class
Draw the duration of the objects on the class lifeline
Insert the object messages from top to bottom of
diagram (time-based)
Check the diagram for completeness
LIFELINES
Elemen notasi lifeline terletak pada posisi atas
diagram
 Represent either roles or object instances that
participate in the sequence being modeled
 Standar penamaan lifeline :


 Instance

Name : Class Name
MESSAGES
The first message of a sequence diagram always starts
at the top and is typically located on the left side of
the diagram for readability.
 Subsequent messages are then added to the diagram
slightly lower then the previous message.
MESSAGE (CONT.)







the analyst object makes a call to the system object which is an instance of the
ReportingSystem class.
The analyst object is calling the system object's getAvailableReports method.
The system object then calls the getSecurityClearance method with the argument of
userId on the secSystem object, which is of the class type SecuritySystem
the secSystem object returns userClearance to the system object when the
getSecurityClearance method is called.
The system object returns availableReports when the getAvailableReports method is
called.
MESSAGE (CONT.)



the system object calling its
determineAvailableReports method.
MESSAGE (CONT.)



Asynchronous Messages : digunakan pada proses
konkurensi
GUARDS


When modeling object interactions, there will be times when a
condition must be met for a message to be sent to the object.



the guard is the text "[pastDueBalance = 0]." By having
the guard on this message, the addStudent message will
only be sent if the accounts receivable system returns a
past due balance of zero
COMBINED FRAGMENTS (ALTERNATIVES,
OPTIONS, AND LOOPS)
A combined fragment is used to group sets of
messages together to show conditional flow in a
sequence diagram.
 The UML 2 specification identifies 11 interaction
types for combined fragments.
ALTERNATIVES
Alternatives are used to designate a mutually
exclusive choice between two or more message
sequences.
 Alternatives allow the modeling of the classic "if then
else" logic e.g.


I buy three items, then I get 20% off my purchase; else I
get 10% off my purchase.

 if
ALTERNATIVES (CONT.)
OPTION
The option combination fragment is used to model a
sequence that, given a certain condition, will occur;
otherwise, the sequence does not occur.
 An option is used to model a simple "if then"
statement (i.e., if there are fewer than five donuts on
the shelf, then make two dozen more donuts).
OPTION (CONT.)

if a student's past due balance equals zero, then the addStudent,
getCostOfClass, and chargeForClass messages are sent. If the student's
past due balance does not equal zero, then the sequence skips sending any
of the messages in the option combination fragment.
LOOPS
Occasionally you will need to model a repetitive
sequence.
 In UML 2, modeling a repeating sequence has been
improved with the addition of the loop combination
fragment.
LOOPS (CONT.)
REFERENCING ANOTHER SEQUENCE
DIAGRAM
Starting in UML 2, the "Interaction Occurrence"
element was introduced.
 Interaction occurrences add the ability to compose
primitive sequence diagrams into complex sequence
diagrams.
 The text "ref" is placed inside the frame's namebox,
and the name of the sequence diagram being
referenced is placed inside the frame's content area
along with any parameters to the sequence diagram.
INTERACTION OCCURRENCE
INTERACTION OCCURRENCE (CONT.)
GATES
Gates can be an easy way to model the passing of
information between a sequence diagram and its
context.
 A gate is merely a message that is illustrated with one
end connected to the sequence diagram's frame's edge
and the other end connected to a lifeline
GATES (CONT.)
GATES (CONT.)
BREAK


almost identical in every way to the option combined
fragment, with two exceptions.






a break's frame has a namebox with the text "break" instead of
"option."
when a break combined fragment's message is to be executed, the
enclosing interaction's remainder messages will not be executed
because the sequence breaks out of the enclosing interaction

break combined fragment is much like the break keyword
in a programming language like C++ or Java
Breaks are most commonly used to model exception
handling
Pertemuan 6-2-sequence-diagram
PARALLEL








When the processing time required to complete portions of
a complex task is longer than desired, some systems handle
parts of the processing in parallel
The parallel combination fragment is drawn using a frame,
and you place the text "par" in the frame's namebox
break up the frame's content section into horizontal
operands separated by a dashed line.
Each operand in the frame represents a thread of execution
done in parallel.
PARALLEL (CONT.)

A microwave is an example of an
object that does two tasks in parallel
SUMMARY
The sequence diagram is a good diagram to use to
document a system's requirements and to flush out a
system's design.
 The reason the sequence diagram is so useful is
because it shows the interaction logic between the
objects in the system in the time order that the
interactions take place.
REFERENCES
UML 2.0 Superstructure Final Adopted Specification
 UML 2 Sequence Diagram Overview
 UML 2 Tutorial
TRY THIS YOURSELF
Draw up a sequence diagram modelling
the case when an advert campaign
manager retrieves the details of a
particular clients advertising campaign
and lists the details of a particular advert
from the campaign. The sequence diagram
should also show the case when a new
advert is created. Only call messages
(synchronous) should be used in this
example and use any iteration conditions
as you deem necessary.
Objects to use: CampainManager, Client,
Campaign, and Advert
A SOLUTION TO PREVIOUS SLIDE
:CampaignManager

:Client

:Campaign

:Advert

getClientName()

listCampaigns()
[For all client's campaigns]*getCampaignDetails()

listAdverts()
[For all adverts in campaign]*getAdvertDetails()

addNewAdvert()
Advert()
new Ad:Advert
TRY THIS TOO
Create a sequence diagram modelling the behaviour of
a PCB drilling machine. The machine will drill holes
in a PCB of given dimensions at a set of given coordinates. Co-ordinates are given as a list, which must
contain at least one set of co-ordinates. Drilling stops
when the end of the list is reached or when a user
interrupts the process.
A SOLUTION TO PREVIOUS SLIDE
loadFile(file)
:Computer

:drillController

:Driller

Drill(coord)
initSeq()

move(offset)

finalSeq()

[while not EOF]*Drill(coord)
QUESTION

More Related Content

What's hot (20)

The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram Tutorial
Creately
Visual Basic User Interface -IV
Visual Basic User Interface -IVVisual Basic User Interface -IV
Visual Basic User Interface -IV
Sharbani Bhattacharya
際際滷 4 Interaction Diagram
際際滷 4 Interaction Diagram際際滷 4 Interaction Diagram
際際滷 4 Interaction Diagram
Niloy Rocker
Intake 37 6
Intake 37 6Intake 37 6
Intake 37 6
Mahmoud Ouf
Jar chapter 4, part 1
Jar chapter 4, part 1Jar chapter 4, part 1
Jar chapter 4, part 1
Reham Maher El-Safarini
Intro to tsql unit 11
Intro to tsql   unit 11Intro to tsql   unit 11
Intro to tsql unit 11
Syed Asrarali
Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)
Manoj Reddy
Intake 37 4
Intake 37 4Intake 37 4
Intake 37 4
Mahmoud Ouf
Vb.net iv
Vb.net ivVb.net iv
Vb.net iv
argusacademy
CS8592 Object Oriented Analysis & Design - UNIT III
CS8592 Object Oriented Analysis & Design - UNIT III CS8592 Object Oriented Analysis & Design - UNIT III
CS8592 Object Oriented Analysis & Design - UNIT III
pkaviya
Lecture12 software design class diagram
Lecture12 software design class diagramLecture12 software design class diagram
Lecture12 software design class diagram
Shahid Riaz
147301 nol
147301 nol147301 nol
147301 nol
Jeyakrishnan V
Intake 38 4
Intake 38 4Intake 38 4
Intake 38 4
Mahmoud Ouf
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
Mahmoud Ouf
Intake 38 6
Intake 38 6Intake 38 6
Intake 38 6
Mahmoud Ouf
Ch6 pointers (latest)
Ch6 pointers (latest)Ch6 pointers (latest)
Ch6 pointers (latest)
Hattori Sidek
Bound and Checked
Bound and CheckedBound and Checked
Bound and Checked
Kevlin Henney
CPU : Structures And Unions
CPU : Structures And UnionsCPU : Structures And Unions
CPU : Structures And Unions
Dhrumil Patel
Variables and calculations_chpt_4
Variables and calculations_chpt_4Variables and calculations_chpt_4
Variables and calculations_chpt_4
cmontanez
Ch7 structures
Ch7 structuresCh7 structures
Ch7 structures
Hattori Sidek
The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram Tutorial
Creately
際際滷 4 Interaction Diagram
際際滷 4 Interaction Diagram際際滷 4 Interaction Diagram
際際滷 4 Interaction Diagram
Niloy Rocker
Intro to tsql unit 11
Intro to tsql   unit 11Intro to tsql   unit 11
Intro to tsql unit 11
Syed Asrarali
Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)
Manoj Reddy
CS8592 Object Oriented Analysis & Design - UNIT III
CS8592 Object Oriented Analysis & Design - UNIT III CS8592 Object Oriented Analysis & Design - UNIT III
CS8592 Object Oriented Analysis & Design - UNIT III
pkaviya
Lecture12 software design class diagram
Lecture12 software design class diagramLecture12 software design class diagram
Lecture12 software design class diagram
Shahid Riaz
Ch6 pointers (latest)
Ch6 pointers (latest)Ch6 pointers (latest)
Ch6 pointers (latest)
Hattori Sidek
Bound and Checked
Bound and CheckedBound and Checked
Bound and Checked
Kevlin Henney
CPU : Structures And Unions
CPU : Structures And UnionsCPU : Structures And Unions
CPU : Structures And Unions
Dhrumil Patel
Variables and calculations_chpt_4
Variables and calculations_chpt_4Variables and calculations_chpt_4
Variables and calculations_chpt_4
cmontanez

Similar to Pertemuan 6-2-sequence-diagram (20)

OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGNOOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
KalyaniLokhande5
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
Amr E. Mohamed
Ood Post1
Ood Post1Ood Post1
Ood Post1
Rajesh Kumar
A novel methodology for test scenario generation based on control flow analys...
A novel methodology for test scenario generation based on control flow analys...A novel methodology for test scenario generation based on control flow analys...
A novel methodology for test scenario generation based on control flow analys...
eSAT Publishing House
Ch14
Ch14Ch14
Ch14
phanleson
Maxbox starter19
Maxbox starter19Maxbox starter19
Maxbox starter19
Max Kleiner
Lecture 17 -18 - Sequence Diagram - Class Diagram.pptx
Lecture 17 -18 - Sequence Diagram - Class Diagram.pptxLecture 17 -18 - Sequence Diagram - Class Diagram.pptx
Lecture 17 -18 - Sequence Diagram - Class Diagram.pptx
i210865
SECh1214
SECh1214SECh1214
SECh1214
Joe Christensen
Cs8592 ooad unit 3
Cs8592 ooad unit 3Cs8592 ooad unit 3
Cs8592 ooad unit 3
VADUGANATHAND1
Cs8592 ooad unit 3
Cs8592 ooad unit 3Cs8592 ooad unit 3
Cs8592 ooad unit 3
MAYILVELKUMARPONNUSA
Case tool lab-Reg2013 by Karthick Raja
Case tool lab-Reg2013 by Karthick RajaCase tool lab-Reg2013 by Karthick Raja
Case tool lab-Reg2013 by Karthick Raja
ursKarthick Raja
Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12
koolkampus
R1x g13 4 diagrams i
R1x g13 4 diagrams iR1x g13 4 diagrams i
R1x g13 4 diagrams i
cairo university
Tech talk
Tech talkTech talk
Tech talk
Preeti Patwa
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction DiagramsSE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
Amr E. Mohamed
UML.pptx
UML.pptxUML.pptx
UML.pptx
RAJESH S
Data Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence DiagramData Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence Diagram
Hamna Shahzad
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
sreeja_rajesh
SCons an Introduction
SCons an IntroductionSCons an Introduction
SCons an Introduction
slantsixgames
Module IV_updated(old).pdf
Module IV_updated(old).pdfModule IV_updated(old).pdf
Module IV_updated(old).pdf
R.K.College of engg & Tech
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGNOOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
OOAD-Unit-3.ppt UML and ANALYSISI AND DESIGN
KalyaniLokhande5
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
Amr E. Mohamed
A novel methodology for test scenario generation based on control flow analys...
A novel methodology for test scenario generation based on control flow analys...A novel methodology for test scenario generation based on control flow analys...
A novel methodology for test scenario generation based on control flow analys...
eSAT Publishing House
Maxbox starter19
Maxbox starter19Maxbox starter19
Maxbox starter19
Max Kleiner
Lecture 17 -18 - Sequence Diagram - Class Diagram.pptx
Lecture 17 -18 - Sequence Diagram - Class Diagram.pptxLecture 17 -18 - Sequence Diagram - Class Diagram.pptx
Lecture 17 -18 - Sequence Diagram - Class Diagram.pptx
i210865
Case tool lab-Reg2013 by Karthick Raja
Case tool lab-Reg2013 by Karthick RajaCase tool lab-Reg2013 by Karthick Raja
Case tool lab-Reg2013 by Karthick Raja
ursKarthick Raja
Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12
koolkampus
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction DiagramsSE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
Amr E. Mohamed
UML.pptx
UML.pptxUML.pptx
UML.pptx
RAJESH S
Data Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence DiagramData Flow Diagram and Sequence Diagram
Data Flow Diagram and Sequence Diagram
Hamna Shahzad
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
sreeja_rajesh
SCons an Introduction
SCons an IntroductionSCons an Introduction
SCons an Introduction
slantsixgames

More from Abi Bobon (11)

Pertemuan 1 pendahuluan
Pertemuan 1   pendahuluanPertemuan 1   pendahuluan
Pertemuan 1 pendahuluan
Abi Bobon
Pertemuan 12-apbo-componen-diagram-dan-deployment-diagram
Pertemuan 12-apbo-componen-diagram-dan-deployment-diagramPertemuan 12-apbo-componen-diagram-dan-deployment-diagram
Pertemuan 12-apbo-componen-diagram-dan-deployment-diagram
Abi Bobon
Pertemuan 10-apbo-mapping-uml-to-code
Pertemuan 10-apbo-mapping-uml-to-codePertemuan 10-apbo-mapping-uml-to-code
Pertemuan 10-apbo-mapping-uml-to-code
Abi Bobon
Pertemuan 10a-apbo-pemetaan-uml-ke-dalam-java
Pertemuan 10a-apbo-pemetaan-uml-ke-dalam-javaPertemuan 10a-apbo-pemetaan-uml-ke-dalam-java
Pertemuan 10a-apbo-pemetaan-uml-ke-dalam-java
Abi Bobon
Pertemuan 9b-apbo-diagram-klass-dan-relasi
Pertemuan 9b-apbo-diagram-klass-dan-relasiPertemuan 9b-apbo-diagram-klass-dan-relasi
Pertemuan 9b-apbo-diagram-klass-dan-relasi
Abi Bobon
Pertemuan 9a-apbo-obyek-dan-klass1
Pertemuan 9a-apbo-obyek-dan-klass1Pertemuan 9a-apbo-obyek-dan-klass1
Pertemuan 9a-apbo-obyek-dan-klass1
Abi Bobon
Pertemuan 6-1-apbo-interaction-diagram
Pertemuan 6-1-apbo-interaction-diagramPertemuan 6-1-apbo-interaction-diagram
Pertemuan 6-1-apbo-interaction-diagram
Abi Bobon
Pertemuan 5-apbo
Pertemuan 5-apboPertemuan 5-apbo
Pertemuan 5-apbo
Abi Bobon
Pertemuan 3-apbo-oo-concept
Pertemuan 3-apbo-oo-conceptPertemuan 3-apbo-oo-concept
Pertemuan 3-apbo-oo-concept
Abi Bobon
Pertemuan 2-apbo-software-developmeng-processing
Pertemuan 2-apbo-software-developmeng-processingPertemuan 2-apbo-software-developmeng-processing
Pertemuan 2-apbo-software-developmeng-processing
Abi Bobon
Pertamuan 4-apbo-use-case-diagram
Pertamuan 4-apbo-use-case-diagramPertamuan 4-apbo-use-case-diagram
Pertamuan 4-apbo-use-case-diagram
Abi Bobon
Pertemuan 1 pendahuluan
Pertemuan 1   pendahuluanPertemuan 1   pendahuluan
Pertemuan 1 pendahuluan
Abi Bobon
Pertemuan 12-apbo-componen-diagram-dan-deployment-diagram
Pertemuan 12-apbo-componen-diagram-dan-deployment-diagramPertemuan 12-apbo-componen-diagram-dan-deployment-diagram
Pertemuan 12-apbo-componen-diagram-dan-deployment-diagram
Abi Bobon
Pertemuan 10-apbo-mapping-uml-to-code
Pertemuan 10-apbo-mapping-uml-to-codePertemuan 10-apbo-mapping-uml-to-code
Pertemuan 10-apbo-mapping-uml-to-code
Abi Bobon
Pertemuan 10a-apbo-pemetaan-uml-ke-dalam-java
Pertemuan 10a-apbo-pemetaan-uml-ke-dalam-javaPertemuan 10a-apbo-pemetaan-uml-ke-dalam-java
Pertemuan 10a-apbo-pemetaan-uml-ke-dalam-java
Abi Bobon
Pertemuan 9b-apbo-diagram-klass-dan-relasi
Pertemuan 9b-apbo-diagram-klass-dan-relasiPertemuan 9b-apbo-diagram-klass-dan-relasi
Pertemuan 9b-apbo-diagram-klass-dan-relasi
Abi Bobon
Pertemuan 9a-apbo-obyek-dan-klass1
Pertemuan 9a-apbo-obyek-dan-klass1Pertemuan 9a-apbo-obyek-dan-klass1
Pertemuan 9a-apbo-obyek-dan-klass1
Abi Bobon
Pertemuan 6-1-apbo-interaction-diagram
Pertemuan 6-1-apbo-interaction-diagramPertemuan 6-1-apbo-interaction-diagram
Pertemuan 6-1-apbo-interaction-diagram
Abi Bobon
Pertemuan 5-apbo
Pertemuan 5-apboPertemuan 5-apbo
Pertemuan 5-apbo
Abi Bobon
Pertemuan 3-apbo-oo-concept
Pertemuan 3-apbo-oo-conceptPertemuan 3-apbo-oo-concept
Pertemuan 3-apbo-oo-concept
Abi Bobon
Pertemuan 2-apbo-software-developmeng-processing
Pertemuan 2-apbo-software-developmeng-processingPertemuan 2-apbo-software-developmeng-processing
Pertemuan 2-apbo-software-developmeng-processing
Abi Bobon
Pertamuan 4-apbo-use-case-diagram
Pertamuan 4-apbo-use-case-diagramPertamuan 4-apbo-use-case-diagram
Pertamuan 4-apbo-use-case-diagram
Abi Bobon

Pertemuan 6-2-sequence-diagram

  • 1. SEQUENCE DIAGRAM E. Haodudin Nurkifli Teknik Informatika Universitas Ahmad Dahlan Pertemuan : 6
  • 2. SEQUENCE DIAGRAM Merupakan suatu diagram interaksi yang memodelkan suatu skenario tunggal yang dijalankan pada sistem Digunakan untuk memperlihatkan interaksi antar obyek dalam perintah yang berurut. Tujuan utama adalah mendefinisikan urutan kejadian yang dapat menghasilkan output yang diinginkan
  • 3. SEQUENCE DIAGRAM Partisipan : obyek atau entitas yang bertindak dalam sequence diagram Message : komunikasi antar obyek partisipan Terdapat 2 tipe garis yaitu vertikal dan horisontal Vertikal : waktu maju berdasarkan waktu Horisontal : obyek mana yang beraksi
  • 4. ELEMEN NOTASI Didefinisikan pada UML 2.0 Digambarkan dalam bentuk frame Bersifat optional untuk menggambarkan batas grafis suatu diagram.
  • 5. ELEMEN NOTASI (CONT.) A sequence diagram that has incoming and outgoing messages
  • 6. ELEMEN NOTASI (LABELING) DiagramType DiagramName The UML specification provides specific text values for diagram types sd = Sequence Diagram, activity = Activity Diagram, use case = Use Case Diagram
  • 7. TYPES OF INTERACTION Creation Synchronous Pesan yang dikirim oleh 1 obyek ke obyek lain dan obyek pertama menunggu sampai hasil aksi selesai. Asynchronous Menunjukkan pesan yang menyebabkan terjadinya pembentukan instan obyek. Pesan yang dikirim oleh 1 obyek ke obyek lain dan obyek pertama tidak menunggu sampai hasil aksi selesai. Reply Menunjukkan nilai kembali dari obyek ke obyek yang megirim pesan Sumber : schaum outline
  • 8. GUIDELINES FOR BUILDING A UML SEQUENCE DIAGRAM 1. 2. 3. 4. 5. 6. Set the context (i.e. scope the system) Identify participating objects Draw arbitrary lifelines for each class Draw the duration of the objects on the class lifeline Insert the object messages from top to bottom of diagram (time-based) Check the diagram for completeness
  • 9. LIFELINES Elemen notasi lifeline terletak pada posisi atas diagram Represent either roles or object instances that participate in the sequence being modeled Standar penamaan lifeline : Instance Name : Class Name
  • 10. MESSAGES The first message of a sequence diagram always starts at the top and is typically located on the left side of the diagram for readability. Subsequent messages are then added to the diagram slightly lower then the previous message.
  • 11. MESSAGE (CONT.) the analyst object makes a call to the system object which is an instance of the ReportingSystem class. The analyst object is calling the system object's getAvailableReports method. The system object then calls the getSecurityClearance method with the argument of userId on the secSystem object, which is of the class type SecuritySystem the secSystem object returns userClearance to the system object when the getSecurityClearance method is called. The system object returns availableReports when the getAvailableReports method is called.
  • 12. MESSAGE (CONT.) the system object calling its determineAvailableReports method.
  • 13. MESSAGE (CONT.) Asynchronous Messages : digunakan pada proses konkurensi
  • 14. GUARDS When modeling object interactions, there will be times when a condition must be met for a message to be sent to the object. the guard is the text "[pastDueBalance = 0]." By having the guard on this message, the addStudent message will only be sent if the accounts receivable system returns a past due balance of zero
  • 15. COMBINED FRAGMENTS (ALTERNATIVES, OPTIONS, AND LOOPS) A combined fragment is used to group sets of messages together to show conditional flow in a sequence diagram. The UML 2 specification identifies 11 interaction types for combined fragments.
  • 16. ALTERNATIVES Alternatives are used to designate a mutually exclusive choice between two or more message sequences. Alternatives allow the modeling of the classic "if then else" logic e.g. I buy three items, then I get 20% off my purchase; else I get 10% off my purchase. if
  • 18. OPTION The option combination fragment is used to model a sequence that, given a certain condition, will occur; otherwise, the sequence does not occur. An option is used to model a simple "if then" statement (i.e., if there are fewer than five donuts on the shelf, then make two dozen more donuts).
  • 19. OPTION (CONT.) if a student's past due balance equals zero, then the addStudent, getCostOfClass, and chargeForClass messages are sent. If the student's past due balance does not equal zero, then the sequence skips sending any of the messages in the option combination fragment.
  • 20. LOOPS Occasionally you will need to model a repetitive sequence. In UML 2, modeling a repeating sequence has been improved with the addition of the loop combination fragment.
  • 22. REFERENCING ANOTHER SEQUENCE DIAGRAM Starting in UML 2, the "Interaction Occurrence" element was introduced. Interaction occurrences add the ability to compose primitive sequence diagrams into complex sequence diagrams. The text "ref" is placed inside the frame's namebox, and the name of the sequence diagram being referenced is placed inside the frame's content area along with any parameters to the sequence diagram.
  • 25. GATES Gates can be an easy way to model the passing of information between a sequence diagram and its context. A gate is merely a message that is illustrated with one end connected to the sequence diagram's frame's edge and the other end connected to a lifeline
  • 28. BREAK almost identical in every way to the option combined fragment, with two exceptions. a break's frame has a namebox with the text "break" instead of "option." when a break combined fragment's message is to be executed, the enclosing interaction's remainder messages will not be executed because the sequence breaks out of the enclosing interaction break combined fragment is much like the break keyword in a programming language like C++ or Java Breaks are most commonly used to model exception handling
  • 30. PARALLEL When the processing time required to complete portions of a complex task is longer than desired, some systems handle parts of the processing in parallel The parallel combination fragment is drawn using a frame, and you place the text "par" in the frame's namebox break up the frame's content section into horizontal operands separated by a dashed line. Each operand in the frame represents a thread of execution done in parallel.
  • 31. PARALLEL (CONT.) A microwave is an example of an object that does two tasks in parallel
  • 32. SUMMARY The sequence diagram is a good diagram to use to document a system's requirements and to flush out a system's design. The reason the sequence diagram is so useful is because it shows the interaction logic between the objects in the system in the time order that the interactions take place.
  • 33. REFERENCES UML 2.0 Superstructure Final Adopted Specification UML 2 Sequence Diagram Overview UML 2 Tutorial
  • 34. TRY THIS YOURSELF Draw up a sequence diagram modelling the case when an advert campaign manager retrieves the details of a particular clients advertising campaign and lists the details of a particular advert from the campaign. The sequence diagram should also show the case when a new advert is created. Only call messages (synchronous) should be used in this example and use any iteration conditions as you deem necessary. Objects to use: CampainManager, Client, Campaign, and Advert
  • 35. A SOLUTION TO PREVIOUS SLIDE :CampaignManager :Client :Campaign :Advert getClientName() listCampaigns() [For all client's campaigns]*getCampaignDetails() listAdverts() [For all adverts in campaign]*getAdvertDetails() addNewAdvert() Advert() new Ad:Advert
  • 36. TRY THIS TOO Create a sequence diagram modelling the behaviour of a PCB drilling machine. The machine will drill holes in a PCB of given dimensions at a set of given coordinates. Co-ordinates are given as a list, which must contain at least one set of co-ordinates. Drilling stops when the end of the list is reached or when a user interrupts the process.
  • 37. A SOLUTION TO PREVIOUS SLIDE loadFile(file) :Computer :drillController :Driller Drill(coord) initSeq() move(offset) finalSeq() [while not EOF]*Drill(coord)