Sequence Diagram Oleh Cosmas Haryawan Pengenalan UML Sequence

  • Slides: 35
Download presentation
Sequence Diagram Oleh : Cosmas Haryawan -- Pengenalan UML --

Sequence Diagram Oleh : Cosmas Haryawan -- Pengenalan UML --

Sequence Diagram n n n Menggambarkan interaksi antar objek di dalam dan di sekitar

Sequence Diagram n n n Menggambarkan interaksi antar objek di dalam dan di sekitar sistem (termasuk pengguna, display, dan sebagainya) berupa message yang digambarkan terhadap waktu Biasa digunakan untuk menggambarkan skenario atau rangkaian langkah-langkah yang dilakukan sebagai respons dari sebuah event untuk menghasilkan output tertentu. Diawali dari apa yang men-trigger aktivitas tersebut, proses dan perubahan apa saja yang terjadi secara internal dan output apa yang dihasilkan.

Sequence Diagram n Sequence diagram terdiri atas: q q n n n Dimensi vertikal

Sequence Diagram n Sequence diagram terdiri atas: q q n n n Dimensi vertikal (waktu) Dimensi horizontal (objek-objek yang terkait). Masing-masing objek, termasuk aktor, memiliki lifeline vertikal. Diagram ini secara khusus berasosiasi dengan use case diagram Memperlihatkan tahap demi tahap apa yang seharusnya terjadi untuk menghasilkan sesuatu didalam use case

Simbol yang digunakan

Simbol yang digunakan

Simbol. . .

Simbol. . .

Partisipant / Object Lifeline n n Pada UML 1 disebut dengan nama Obyek Diletakkan

Partisipant / Object Lifeline n n Pada UML 1 disebut dengan nama Obyek Diletakkan dari kiri ke kanan Setiap Partisipant terhubung dengan lifeline Standar penamaan q Instance Name : Class Name

Time / Lifeline n n Mewakili waktu pada arah vertikal, dimulai dari atas ke

Time / Lifeline n n Mewakili waktu pada arah vertikal, dimulai dari atas ke bawah Garis putus-putus yang menempel di partisipant lifeline

Action n Mewakili sebuah eksekusi operasi dari partisipant Kotak kecil segiempat di lifeline Panjang

Action n Mewakili sebuah eksekusi operasi dari partisipant Kotak kecil segiempat di lifeline Panjang kotak berbanding lurus dengan durasi activation

Message n n n Message berpindah dari 1 lifeline ke lifeline yang lain Message

Message n n n Message berpindah dari 1 lifeline ke lifeline yang lain Message yan pertama kali muncul di SSD terletak paling atas, kemudian message yang berikutnya berada di bawahnya Terdapat 3 macam : q q q Synchronus Asynchronus Reply / Return

Message… n Synchronous ● n Asynchronous ● n Pesan yang dikirim oleh 1 obyek

Message… n Synchronous ● n Asynchronous ● n Pesan yang dikirim oleh 1 obyek ke obyek lain dan obyek pertama menunggu sampai hasil aksi selesai. Pesan yang dikirim oleh 1 obyek ke obyek lain dan obyek pertama tidak menunggu sampai hasil aksi selesai. Reply/Return ● Menunjukkan nilai kembali dari obyek ke obyek yang mengirim pesan

Message … n n n the analyst object makes a call to the system

Message … n n n the analyst object makes a call to the system object which is an instance of the Reporting. System class. The analyst object is calling the system object's get. Available. Reports method. The system object then calls the get. Security. Clearance method with the argument of user. Id on the sec. System object, which is of the class type Security. System the sec. System object returns user. Clearance to the system object when the get. Security. Clearance method is called. The system object returns available. Reports when the get. Available. Reports method is called.

Fun Example Objects Sequence and Collaboration Diagrams 12 12

Fun Example Objects Sequence and Collaboration Diagrams 12 12

Fun Example Sequence diagram Sequence and Collaboration Diagrams 13 13

Fun Example Sequence diagram Sequence and Collaboration Diagrams 13 13

Fun Example Sequence diagram Sequence and Collaboration Diagrams 14 14

Fun Example Sequence diagram Sequence and Collaboration Diagrams 14 14

Recursive n n n Suatu Obyek yang memanggil dirinya sendiri Digambarkan dengan menambah kotak

Recursive n n n Suatu Obyek yang memanggil dirinya sendiri Digambarkan dengan menambah kotak kecil pada activation Cotoh : system object memberi pesan ke dirinya sendiri : menentukan Laporan apa saja yang ada

Hapus Partisipant n Partisipant bisa menghapus dirinya sendiri atau bisa juga dihapuskan oleh object

Hapus Partisipant n Partisipant bisa menghapus dirinya sendiri atau bisa juga dihapuskan oleh object lain

Petunjuk membuat SD 1. 2. 3. 4. 5. 6. Mengacu ke skenario Use Case

Petunjuk membuat SD 1. 2. 3. 4. 5. 6. Mengacu ke skenario Use Case / Stimulus-Response Identifikasi participant objects Gambar lifelines untuk tiap object Gambar duration tiap object pada lifeline Tambahkan object messages dari atas ke bawah pada diagram (time-based) Check ulang diagram untuk kelengkapannya

Guards n Kondisi : suatu syarat agar message dikirim the guard is the text

Guards n Kondisi : suatu syarat agar message dikirim the guard is the text "[past. Due. Balance = 0]. " By having the guard on this message, the add. Student message will only be sent if the accounts receivable system returns a past due balance of zero

Combined fragments n n n digunakan untuk mengelompokkan message, tergantung kondisi tertentu disebut juga

Combined fragments n n n digunakan untuk mengelompokkan message, tergantung kondisi tertentu disebut juga Interaction Fragment (Kerangka Interaksi) UML 2 specification mengidentifikasi 11 operator untuk combined fragments.

Format Combined op (operator): applied to the enclosed interaction(s) (some operators require arguments, such

Format Combined op (operator): applied to the enclosed interaction(s) (some operators require arguments, such as diagrams names, parameters, constants and guards) op [: arguments] [ [guard] ] diagram name | interaction diagram name: needed if we want to refer to a diagram defined elsewhere [guard]: a boolean expression the interaction is executed according to the guard’s value interaction: a (fragment of a) sequence diagram (it can contain other frames) if we need to enclose more interactions, we’ll separate them with an outlined line (see next slide)

Contoh n n satu set interactions dipisahkan dengan garis putus-putus interaction_i dijalankan jika guard_i

Contoh n n satu set interactions dipisahkan dengan garis putus-putus interaction_i dijalankan jika guard_i bernilai benar op [guard_1] interaction_1 … [guard_n] interaction_n

Operator Combined Fragment n Alternatives (alt) q q n Option (opt) q n Represents

Operator Combined Fragment n Alternatives (alt) q q n Option (opt) q n Represents an alternative that is executed instead of the remainder of the fragment (like a break in a loop) Parallel (par) q n Special case of alternative hanya berisi 2 pilihan Break (break) q n choice of behaviors – at most one will execute depends on the value of the guard (“else” guard supported) Concurrent (interleaved) sub-scenarios, fragmen berjalan secara pararel Negative (neg) q Identifies sequences that must not occur (interaksi yang salah)

Operator… n Critical Region (region) q n Fragmen tidak dapat disela dengan kejadian lain

Operator… n Critical Region (region) q n Fragmen tidak dapat disela dengan kejadian lain pada participating lifeline Loop (loop) q q Optional guard: [<min>, <max>, <Booleanexpression>] Tanpa Guard berarti tidak ada batas

Alternative

Alternative

Option if a student's past due balance equals zero, then the add. Student, get.

Option if a student's past due balance equals zero, then the add. Student, get. Cost. Of. Class, and charge. For. Class 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.

Loop

Loop

Ref

Ref

Ref…

Ref…

Break n almost identical in every way to the option combined fragment, with two

Break n almost identical in every way to the option combined fragment, with two exceptions. q q n 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 Breaks are most commonly used to model exception handling

Pararel

Pararel

Contoh SD online-bookshop

Contoh SD online-bookshop

Contoh SD Pemesanan Buku

Contoh SD Pemesanan Buku

Contoh SD FB Otentifikasi

Contoh SD FB Otentifikasi

Diambil dari : Hendra

Diambil dari : Hendra

Diambil dari : Hendra

Diambil dari : Hendra