Use Case
UML • Bahasa pemodelan visual sistem berorientasi objek • Yang dibahaas dalam kuliah ini: – Use Case – Ac>vty Diagram – Class Diagram – Sequence Diagram
Penger>an Use Case • Ivar Jacobson (1990-‐an) : “A use case is a specific way of using the system by performing some part of the func>onality. Each use case cons>tutes a complete course of events ini>ated by an actor, and it specifies the interac>on that takes place between an actor and the system…... The collected use cases specify all the exis>ng ways of using the system.”
Penger>an Use Case • Grady Booch: If you design a new house and you are reasoning about how you and your family will use it, this is use case-‐based analysis. You consider the various ways in which you‘ll use the house, and these use cases drive the design
Penger>an Use Case • Menggambarkan interaksi antara user/aktor dengan sistem • Jadi, Use Case akan menggambarkan bagaimana sistem akan digunakan oleh user • Fokus dari Use Case adalah fitur/ fungsionalitas apa saja yang harus disediakan oleh sistem dan siapa user/aktor yang akan menggunakan fitur/fungsionalitas tersebut
User/Aktor • En>tas eksternal yang berinteraksi dengan sistem – Manusia – Sistem lain
Tujuan Use Case • Memodelkan kebutuhan fungsional sistem • Menunjukkan konteks dari sistem • Dapat digunakan sebagai acuan untuk melakukan pengujian validasi
Simbol Use Case • Aktor
• Asosiasi actor
• Use Case use case
• Boundary Sistem
Contoh register as student register for course
adm
register for exam student
works with course
instructor
lab System Boundary
make/edit course lecturer
Macam-‐Macam Relasi Aktor dengan Usse Case
use case actor Both actor and use case can ini2ate the communica2on.
use case actor The actor ini2ate the communica2on.
use case actor The use case ini2ate the communica2on.
Relasi dalam Use Case • Generalisasi • Include • Extend
Use Case: Include • Terdapat 2 usecase (misal A dan B) dimana salah satu use case (A) memiliki ketergantungan dengan satu use case yang lain (B). • Jika use case A dijalankan, maka selalu use case B juga berperan
Use Case: Include Validate student
“include”
Register for course base
• Student register for course, main flow of event: – The use case starts when the student brows the course register page. – The user write user name and password. – Inclusion point: Validate student – The system presents all possible courses for this student. – The student select course and commits the entry by pressing the Enter bu[on.
Use Case: Include
make student profile
validate student for study “include” “include”
student
register as student
“include”
enter student in “student register”
adm
Use Case: Include
• Relasi include ditandai dg stereotype: – “include” – <
>
Use Case: Extend • Terdapat 2 usecase (misal A dan B) dimana salah satu use case (A) memiliki ketergantungan secara opsional dengan satu use case yang lain (B). • Misal, jika use case A dijalankan, maka bisa jadi use case B juga jalan, atau mungkin juga use case B >dak ikut jalan (opsional)
Use Case: Extend Buy Goods «extend» Buyer returns goods
• Pada relasi extend, dalam use case “Buy Goods” kita menentukan suatu kondisi kapan use case “Buyer returns goods” akan dijalankan kapan >dak
Use Case: Extend
Use Case: Generalisasi • Biasanya digunakan untuk menggambarkan suatu aktor yang merupakan turunan (inherit) dari aktor yang lain • Juga bisa digunakan untuk menggambarkan suatu use case yang menurun dari use case lain. Atau menunjukan dua use case yang memiliki relasi umum-‐khusus
guest
Browse book <>
member
Borrow book <<
Update membership
Skenario Use Case/Narasi Use Case • Memberikan uraian secara mendetail dari suatu use case • Tiap use case dibuatkan skenario use case
Use Case Example [1] -‐ Use Case: 5 Buy Goods
CHARACTERISTIC INFORMATION Goal in Context: Buyer issues request directly to our company, expects goods shipped and to be billed. Precondi>ons: We know Buyer, their address, etc. Success End Condi>on: Buyer has goods, we have money for the goods. Failed End Condi>on: We have not sent the goods, Buyer has Company is out of one not spent the money. of the items Primary Actor: Buyer, any agent (or computer) ac>ng for the customer «extend» Trigger: purchase request Buyer pays directly comes in. Buy Goods
«extend»
S>muli
Buyer
with credit card
«extend» Buyer returns goods
Use Case: 5 Buy Goods Each step take the form ”A does X”, where A is -‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐ an actor and X is an ac>on. If a use case is MAIN SUCCESS SCENARIO included you will find a step that has the form 1. Buyer calls in with a purchase request. ”include U”, where U is another use case. 2. Company captures buyer’s name, Extension 3a is execute instead of 3 if condi>on: address, requested goods, etc. ”Company is out of one of the ordered items” is 3. Company gives buyer informa>on on fulfilled! goods, prices, delivery dates, etc. Company is out of one of the items 4. Buyer signs for order. 5. Company creates order, ships order to buyer. «extend» 6. Company ships invoice to buyer. Buyer pays directly 7. Buyers pays invoice. Buy Goods with credit card «extend» -‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐ EXTENSIONS Buyer 3a. Company is out of one of the ordered items: «extend» 3a1. Renego>ate order. Buyer returns goods 4a. Buyer pays directly with credit card: 4a1. Take payment by credit card (use case 44) 7a. Buyer returns goods: 7a. Handle returned goods (use case 105)