BAB VI USE CASE
Use Case Model • Teknik pemodelan untuk mendapatkan functional requirement dari sebuah sistem • Menggambarkan interaksi antara pengguna dan sistem • Menjelaskan secara naratif bagaimana sistem akan digunakan • Menggunakan skenario untuk menjelaskan setiap aktivitas yang mungkin terjadi • Kadangkala notasi kurang detail, terutama untuk beberapa aktivitas tertentu
Kapan Menggunakan Use Case? • Use case sederhana digunakan pada saat proses requirement analysis - Tidak semua pengguna paham bahasa teknis
• Versi yang lebih detail dibuat sebelum implementasi rancangan - Dibuat khusus untuk mempermudah desain sistem oleh para developer
Skenario •
Buy a product scenario *
The customer browses the catalog and adds desired items to the shopping basket.
*
When the customer wishes to pay, the customer describes the shipping and credit card information and confirms the sale * The system checks the authorization on the credit card and confirms the sale both immediately and with a follow-up e-mail
•
Bagaimana jika proses pembayaran menggunakan CC gagal atau konsumen lama yang tidak perlu merekam informasi CC?
Buat skenario baru
• Catatan: Proses pada skenario tidak selalu harus berhasil Kesimpulan: * USE CASE adalah sekumpulan skenario yang dihubungkan satu sama lain dengan satu tujuan yang sama dari pengguna * Use Case berisi apa yang dilakukan oleh sistem / apa yang terjadi pada sistem, bukan bagaimana sistem melakukan
Level Use Case Model Use Case memiliki dua istilah * System use case : interaksi dengan sistem * Business use case : interaksi bisnis dengan konsumen atau kejadian nyata
Cookburn menyarankan adanya pembedaan level * Sea level : interaksi sistem dengan aktor utama *
Fish level: use case yang ada karena include dari use case sea-level
* Kite level : menggambarkan sea-level use case untuk interaksi bisnis yang lebih luas
Use Case Mdl. Key Elements What actions or procedures exist within a system Use Case Who’s involved in those actions Actor How those actions related to each other in a system Relationship
Element: Use Case Aksi yang terdapat di dalam sistem, melingkupi semua aksi yang harus maupun dapat terjadi Tidak harus berelasi dengan seorang/ sebuah aktor Pada umumnya berupa kata kerja
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
• Actor menggambarkan segala sesuatu yang berinteraksi dengan sistem untuk melakukan pertukaran informasi. Actor adalah pengguna, pemeran (role), yang bisa berupa sistem eksternal maupun orang. • Actor menginisiasi aktivitas sistem, dalam bentuk use case, bertujuan untuk melengkapi beberapa kegiatan bisnis. • Actor menggambarkan peranan yang dilakukan oleh user yang berinteraksi dengan sistem dan bukan menggambarkan individual jabatan pekerjaan.
Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
Element: Actor Dalam notasi Use Case, pengguna sistem disebut dengan Actor (role) Actor bisa berupa manager, pimpinan, mahasiswa, dan lain sebagainya * Actor tidak harus berupa manusia * Jika sistem A mengerjakan sebuah fungsi untuk sistem sistem B, maka sistem B disebut actor Satu use case diagram bisa memiliki banyak
actor didalamnya
Use Case Models USE CASE TEXT
USE CASE DIAGRAM
* lebih detail
* lebih abstrak kurang detail * bentuk visual (gambar) * Cocok untuk berkomunikasi dengan client
* tidak ada visualisasi (berbentuk teks) * Cocok bagi developer
Use Case Text Pilih salah satu skenario sebagai skenario utama yang sukses Tuliskan langkah-langkah untuk menyelesaikan skenario tersebut
* *
Setiap langkah menampilkan tujuan dari sang actor Tidak perlu menuliskan bagian user interface
Tulis skenario lain dan sebut sebagai extensions ,variasi dari skenario utama
* Extension bisa sukses atau gagal, tetapi interaksinya harus berbeda dengan skenario utama
* Extension bisa kembali ke skenario utama
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Keuntungan Use Case
1. Sebagai dasar untuk membantu mengidentifikasi objek-objek dan hubungan tingkat tinggi dan tanggung jawab masing-masing. 2. Sebagai gambaran dari behavior sistem yang akan dibuat dari sisi pengguna eksternal. 3. Sebagai alat yang efektif untuk memvalidasi kebutuhan. 4. Sebagai alat komunikasi yang efektif 5. Sebagai dasar untuk melakukan perencanaan testing. 6. Sebagai dasar untuk melakukan pembuatan user manual.
Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Langkah-langkah dalam membuat use case modeling
1. Mengidentifikasi actor-actor tambahan dan use case-use case 2. Buatlah model Use Case 3. Dokumentasikan kejadian-kejadian dalam Use Case 4. Definisikan Analysis Use Cases
Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Step 1: Identifying Actors and Use Cases Actor Potential Member Club Member Club Member Club Member Club Member Club Member Past Member Marketing Marketing Marketing
Time Time Time Time Time
Use Case Name SUBMIT NEW SUBSCRIPTION PLACE NEW MEMBER ORDER MAKE ACCOUNT INQUIRY MAKE PURCHASE INQUIRY MAINTAIN MEMBER ORDER SUBMIT CHANGE OF ADDRESS SUBMIT RESUBSCRIPTION SUBMIT NEW MEMBER SUBSCRIPTION PROGRAM SUBMIT PAST MEMBER RESUBSCRIPTION PROGRAM SUBMIT NEW PROMOTION
GENERATE QUARTERLY PROMOTION ANALYSIS GENERATE QUARTERLY SALES ANALYSIS GENERATE QUARTERLY MEMBERSHIP ANALYSIS GENERATE ANNUAL SALES ANALYSIS GENERATE ANNUAL MEMBERSHIP ANALYSIS
Irwin/McGraw-Hill
Use Case Description Potential member joins the club by subscribing. (“Take anu 12 CDs for one penny and agree to buy 4 more at regular club prices within two years.”) Club member places order. Club member wants to examine his or her account history. (90-day time limit) Club member inquires about his/her purchase history. (three-year time limit) Club member wants to revise an order or cancel an order. Club member changes address. (including e-mail and privacy code) Past member rejoins the club by resubscribing. Marketing establishes a new membership resubscription plan to entice new members. Marketing establishes a new membership resubscription plan to lure back former members. Marketing initiates a promotion. (Note: A promotion features specific titles, usually new, that company is trying to sell at a special price. These promotions are integrated into a catalog sent (or communicated) to all members.) Print quarterly promotion analysis report. Print annual sales analysis report. Print annual membership analysis report. Print annual sales analysis report. Print annual membership analysis report. Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Step 2: Constructing a Use Case Model Diagram Subscription Subsystem
Order Subsystem Maintain Member Order
Submit Change of Address initiates
Submit New Subscription
Potential Member initiates
Club Member initiates
Place New Member Order
Submit Resubscription
initiates
initiates
initiates Submit Past Member Resubscription Program
Make Purchase Inquiry
Submit New Member Subscription Program
Past Member
initiates
Operations Subsystem Make Account Inquiry
Generate Annual Sales Analysis
Generate Quarterly Sales Analysis
Irwin/McGraw-Hill
Promotion Subsystem Generate Quarterly Membership Analysis
initiates
initiates Generate Annual Membership Analysis
initiates
Time
Marketing
initiates
initiates
initiates
Generate Quarterly Promotion Analysis
Submit New Promotion
initiates
initiates
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Step 3: Documenting the Use Case Typical Course Author: S. Shepard
Date: 10/05/2000
Use Case Name: Submit New Member Order Actor(s): Member Description: This use case describes the process of a member submitting an order for SoundStage products. On completion, the member will be sent a notification that the order was accepted. References: MSS-1.0 1 System response Typical Course Step 2: The member’s personal information such as Actor Action of Events: address is validated against what is currently Step 1: This use case is recorded in member services. initiated when a member 2 Step 3: The member’s credit status is checked with submits an order to be Accounts Receivable to make sure no processed payments are outstanding. Step 4: For each product being ordered, validate the product number and then check the availability in inventory and record the ordered product information. Step 5: Create a picking ticket for the member order containing all ordered products that are available and route it to the warehouse for processing. Step 6: Generate an order confirmation notice indicating the status of the order and send it to the member. Step 7: This use case concludes when the member receives the order confirmation notice. Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Step 3: Documenting the Use Case Typical Course (concluded) Alternate Courses:
Pre-condition:
Step 2: If the club member has indicated an address or telephone number change on the promotion order, update the club member’s record with the new information. Step 3: If Accounts Receivable returns a credit status that the customer is in arrears, send an order rejection notice to the member. Step 4: If the product number is not valid, send a notification to the member requesting them to submit a valid product number. If the product being ordered is not available, record the ordered product information and mark as “back-ordered.” Orders can only be submitted by members.
Post-condition:
Member order has been recorded and the picking ticket has been routed to the warehouse.
Assumptions:
None at this time.
Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Extension and Abstract Use Cases
• An extension use case extends the functionality (typical course) of an original use case. An extension use case can only be invoked by the use case it is extending. • An abstract use case contains typical course steps that were common to two or more original use cases. An abstract use case reduces redundancy and promotes reuse.
Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Depicting Extension and Abstract Use Cases using UML Notation Generate Warehouse Packing Order
Calculate Order Subtotal & Sales Tax
Extension use case
Extension use case
Place New Member Order
Revise Street Address Abstract use case
Submit Change of Address Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Step 4: Defining the Analysis Use Case Author: S. Shepherd
USE CASE NAME: ACTOR(S): DESCRIPTION: REFERENCES TYPICAL COURSE OF EVENTS:
Irwin/McGraw-Hill
ANALYSIS USE CASE
Date: 10/25/2000
Place New Member Order Club Member This use case describes the process of a club member submitting a new order for SoundStage products. On completion, the club member will be sent a notification that the order was accepted. MSS-1.0 Actor Action System Response Step 1: This use case is initiated Step 2: The member’s personal information such as when a member submits an address and phone number is validated against what is order to be processed. currently on file. Step 3: For each product being ordered, validate the product number. Step 4: For each product being ordered, check the availability in inventory and record the ordered product information such as the quantity being ordered. Step 5: Invoke extension use case Calculate Order Subtotal & Sales Tax. Step 6: The member’s credit card information is verified based on the amount due and Accounts Receivable transaction data is checked to make sure no payments are outstanding. Step 7: Invoke extension use case Generate Warehouse Step 9: This use case concludes Packing Order. when the member receives the Step 8: Generate an order confirmation notice indicating order confirmation notice. the status of the order and send it to the member. (continued)
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Step 4: Defining the Analysis Use Case (concluded)
ALTERNATE COURSES:
Step 2: If the club member has indicated an address or telephone number change on the order, invoke abstract use case Revise Street Address. Step 3: If the product number is not valid, send a notification to the member requesting the member to submit a valid product number. Step 4: If the product being ordered is not available, record the ordered product information and mark the order as “backordered.” Step 6: If member’s credit card information is invalid or if member is found to be in arrears, a credit problem notice is sent to the member. Modify the order’s status to be “on hold pending payment.”
PRECONDITION:
Orders can only be submitted by members.
POSTCONDITION:
Member order has been recorded and the Packing Order has been routed to the Warehouse.
ASSUMPTIONS:
None at this time.
Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Finding and Identifying Business Objects
• Step 1: Find the Potential Objects – Underlining (or highlighting) the use case nouns
• Step 2: Select the Proposed Objects – Removing the nouns that represent: • • • • •
Irwin/McGraw-Hill
Synonyms Nouns outside the scope of the system Nouns that are roles without unique behavior or are external roles Unclear nouns that need focus Nouns that are really actions or attributes
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Use Case with Nouns Highlighted Author: S. Shepherd
USE CASE NAME: ACTOR(S): DESCRIPTION: REFERENCES TYPICAL COURSE OF EVENTS:
ANALYSIS USE CASE
Date: 10/25/2000
Place New Member Order Club Member This use case describes the process of a club member submitting a new order for SoundStage products. On completion, the club member will be sent a notification that the order was accepted. MSS-1.0 Actor Action System Response Step 1: This use case is initiated Step 2: The member’s personal information such as when a member submits an address and phone number is validated against what is order to be processed. currently on file. Step 3: For each product being ordered, validate the product number. Step 4: For each product being ordered, check the availability in inventory and record the ordered product information such as the quantity being ordered. Step 5: Invoke extension use case Calculate Order Subtotal & Sales Tax. Step 6: The member’s credit card information is verified based on the amount due and Accounts Receivable transaction data is checked to make sure no payments are outstanding. Step 7: Invoke extension use case Generate Warehouse Packing Order. Step 9: This use case concludes when the member receives the Step 8: Generate an order confirmation notice indicating the status of the order and send it to the member. order confirmation notice. (continued)
Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Use Case with Nouns Highlighted (concluded)
ALTERNATE COURSES:
Step 2: If the club member has indicated an address or telephone number change on the order, invoke abstract use case Revise Street Address. Step 3: If the product number is not valid, send a notification to the member requesting the member to submit a valid product number. Step 4: If the product being ordered is not available, record the ordered product information and mark the order as “backordered.” Step 6: If member’s credit card information is invalid or if member is found to be in arrears, a credit problem notice is sent to the member. Modify the order’s status to be “on hold pending payment.”
PRECONDITION:
Orders can only be submitted by members.
POSTCONDITION:
Member order has been recorded and the Packing Order has been routed to the Warehouse.
ASSUMPTIONS:
None at this time.
Irwin/McGraw-Hill
Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Potential Objects Extracted from Use Case POTENTIAL OBJECT LIST
Irwin/McGraw-Hill
Accounts Receivable Department Amount Due Club Member Credit Card Information Credit Problem Notice Credit Status File Marketing Department Member Address Member Order Member Phone Number Member Services Department Member Services System Order Order Confirmation Notice Order Sales Tax Order Status Order Subtotal Ordered Product Ordered Product Information Ordered Product Quantity Past Member Payments Potential Member Product Product Inventory Product Number Street Address Transaction Warehouse The Mcgraw-Hill Companies All Right reserved Warehouse Packing Copyrighth@2000 Order
SYSTEMS ANALYSYS AND DESIGN METHODS 5TH Edition
Whitten Bentley Dittman
Analysis of the Potential Objects REASON
POTENTIAL OBJECT LIST Accounts Receivable Department Amount Due Club Member Credit Card Information Credit Problem Notice Credit Status File Marketing Department Member Address Member Order Member Phone Number Member Services Department Member Services System Order Order Confirmation Notice Order Sales Tax Order Status Order Subtotal Ordered Product Ordered Product Information Ordered Product Quantity Past Member Payments Potential Member Product Product Inventory Product Number Street Address Transaction Warehouse Warehouse Packing Order Irwin/McGraw-Hill
x x / x x x x x x / x x x x x x x x / x x / / / / x x x / x x
Not relevant for current project Attribute of “MEMBER ORDER” Type of “MEMBER” Attribute of “MEMBER” Potential Interface item to be addressed in object-oriented design Attribute of “MEMBER” Not relevant for current project Not relevant for current project Attribute of “MEMBER” “MEMBER ORDER” Attribute of “MEMBER” Not relevant for current project Not relevant for current project Another name for “MEMBER ORDER” Potential Interface item to be addressed in object-oriented design Attribute of “MEMBER ORDER” Attribute of “MEMBER ORDER” Attribute of “MEMBER ORDER” “MEMBER ORDERED PRODUCT” Unclear noun Attribute of “MEMBER ORDERED PRODUCT” Type of “MEMBER” Type of “TRANSACTION” Type of “MEMBER” “PRODUCT” Attribute of “PRODUCT” Attribute of “PRODUCT” Attribute of “MEMBER” “TRANSACTION” Not relevant for current project Potential Interface item to be addressed in object-oriented design Copyrighth@2000 The Mcgraw-Hill Companies All Right reserved
Developing Software Woth UML
Booch Jacobson Rumbaugh
• Sebuah use case menjelaskan interaksi antara user dengan sistem aplikasi. • Sebagai contoh dalam sebuah sistem reservasi peminjaman mobil (rent a car), sebuah use case harus dapat menjelaskan apa yang user lakukan dengan sistem aplikasi dalam sebuah kejadian/event bisnis dalam sebuah proses bisnis. Misalnya reservasi sebuah mobil Ferrari untuk Pak Agus. • Sebuah proses dapat dibagi menjadi beberapa use case jika dapat diketahui dengan jelas tiap-tiap kejadiannya atau jika bagian-bagian yang diidentifikasi tersebut dikerjakan oleh orang-orang yang berbeda. • Jika diasumsikan sistem yang akan di analisa adalah Sistem Informasi Peminjaman Mobil (Rent a car) maka orang yang akan kita temui adalah: Addison-Wesley
Developing Software Woth UML
Booch Jacobson Rumbaugh
• Customer service (central telephone operator) – Information – Reservation
• Customer service (branch office) – Vehicle hand-over – Vehicle return
• • • •
Service personnel (branch office, vehicle clerk) Branch office management Phone service management Managing clerks, vehicle transfer staff, accounting staff (jika diperlukan)
Addison-Wesley
Developing Software Woth UML
Booch Jacobson Rumbaugh
Objek-objek yang disebutkan diatas harus dapat diidentifikasi dan diberi nama. Sebagai contoh objek-objek tersebut adalah: • • • • • • •
Data customer Kontrak Invoice Konfirmasi reservasi Aturan pengembalian mobil Aturan pemarkiran Dokumentasi kendaraan
Addison-Wesley
Developing Software Woth UML
• • • • • • •
Aksesories yang ada dalam mobil Fixed accessories (AC, tape, sun roof) Kunci-kunci kendaraan File-file customer Alokasi / lot tempat parkir Contract condition / aturan kontrak Dsb.
Addison-Wesley
Booch Jacobson Rumbaugh
Developing Software Woth UML
Booch Jacobson Rumbaugh
Identifikasi use case dan actor • Gambar use case dari kasus diatas dapat dilihat pada gambar di bawah ini. Disini actor-nya adalah interested party yaitu customer, dan staff untuk reservasi (staff for reservation), penyerahan mobil yang akan dipinjam (vehicle hand-over) dan pengembalian mobil (vehicle return) • Interested party (Calon customer) berbeda dengan Customer, karena calon customer biasanya belum ada datanya (anonymous), karena data mereka belum terdaftar
Addison-Wesley
Developing Software Woth UML
Booch Jacobson Rumbaugh
Car Rental Agency
Advise, give information Interested Party
<
> reserve
Reservation Staff
Stipulate contract
Customer
Handover vehicle
Hand-over staff
Take back vehicle
Driver
Return Staff
Invoice
Customer
Addison-Wesley
Developing Software Woth UML
Booch Jacobson Rumbaugh
Business use case dan System use case
Dalam bisnis use case, actor adalah semua peran (role) yang terlibat dalam proses bisnis, sedangkan dalam system use case, mereka dibatasi hanya kepada mereka yang mempunyai kontak langsung dengan sistem aplikasi. Biasanya customer tidak memiliki akses langsung dengan sistem aplikasi, tetapi dalam bisnis use case mereka tetap dicatat. Jika customer dapat melakukan reservasi melalui self-service terminal atau melalui internet, mereka berinteraksi langsung dengan sistem aplikasi dan oleh karena itu mereka harus digambarkan dalam system use case.
Addison-Wesley
Developing Software Woth UML
Booch Jacobson Rumbaugh
Jika use case car rental agency diatas dikelompokkan, bentuknya : Reservation Advise, give information
Interested party
<>
Reservation
Reserve Customer
Rental Stipulate contract
Vehicle hand-over Hand over vehicle
Driver
Accept return vehicle
Vehicle return
Invoicing
Customer
Addison-Wesley
Invoice
Developing Software Woth UML
Booch Jacobson Rumbaugh
Menggunakan use case
• Menggambarkan use case dalam bentuk diagram elips adalah langkah pertama, setelah itu yang berikutnya adalah menjelaskannya dalam bentuk lebih detil lagi. • Penjelasan detil dari use case adalah tujuan utama dari use case analysis untuk itu ada dua contoh yang menggambarkan use case lebih detil.
Addison-Wesley