110 likes | 128 Views
Understand how use cases, diagrams depict system interactions & behavior. Learn roles, notations, extension points, narrative examples, and diagrams' significance.
E N D
Use Cases CS 124
Depicting System Behavior • Use Cases • Use case: typical interaction between a user and the system • Use case diagram: depicts all use cases for a system • Role of use cases in other UML diagrams • Interaction diagram: depicts a use case as a collection of interacting objects • State Diagram: depicts state changes for an object across different use cases
Example:Use Case Diagram LIBRARY SYSTEM Facilitate Checkout Search for Book Borrower Librarian Facilitate Return
Use Case Diagram Notation • Stick Figures – Actors • Could be a human user or a subsystem • Ellipses - Use Cases • Links - between actors and use cases • Links between use cases • <<includes>>: to depict inclusion of a use case • <<extends>>: to depict variations of a general use case
Example: <<includes>> Facilitate Checkout <<includes>> Log-in Librarian <<includes>> Facilitate Return
Example: <<extends>> By Author <<extends>> Search for Book query Borrower <<extends>> By Subject Note: query is called an extension point
Describing a Use Case • Narrative • Library example (Facilitate Checkout): Given a borrower’s ID Card and the book to be borrowed, the librarian enters the borrower’s ID number and the book’s catalogue number. If the borrower is allowed to check out the book, the system displays that the book has been recorded as borrowed • Or, an Interaction Diagram
Interaction Diagram Example 2: checkIfAvailable() Checkout Screen :Book 1: checkIfDelinquent() 3: borrowBook() 4: setBorrower() :Borrower
State Diagram Example start Reserved release New reserve Borrowed borrow activate return Available
State Diagram Example start Use cases Reserved release New reserve Borrowed borrow activate return Available
About use cases • Use cases are most useful during analysis (conceptual perspective) • Narrative and diagram are not too technical • No strict correspondences with code • There are meaningful correspondences with other diagrams • Interaction diagrams • State diagrams