Use Cases Yonglei Tao
Typical Commercial Applications 300-600 entries in model dictionary 20-100 use cases 5-20 activities per use case 100-500 domain classes 1 to 12 operations per class
Use Cases Use case-iteration allocation matrix Business goals & needs Current situation Accommodating Requirements Change Customer feedback Acquiring Requirements Iteration use cases Domain Modeling Preliminary requirements Domain model Domain model Deriving Use Cases from Requirements Actor-System Interaction Modeling Abstract & high level use cases, use case diagrams Expanded use cases & UI design Allocating Use Cases & Subsystems to Iterations Behavior Modeling & Responsibility Assignment Behavior models Use case-iteration allocation matrix Deriving Design Class Diagram Producing an Architecture Design Design class diagram Software architecture Test Driven Development, Integration, & Deployment (a) Planning Phase (b) Iterative Phase – activities during each iteration
A Use Case Diagram Library System Patron Checkout Document Return Document Patron Search for Document
Simplify with Use of Inheritance Library System Checkout a Document Patron Return a Startup Shutdown Admin
Simplify with Use of Inheritance Login Logout SAMS/Search Program SAMS End User Admin Staff This is OK. Login Logout SAMS/Search Program SAMS End User Admin Staff Better
Are These Use Cases? Why? Check authorization / check authentication Enter a password Process data Open a file Click on a menu item Traverse a linked list. Start a system
Use Case Diagram – Overly Complex Log In Log Out Start Up SAMS End User Staff User Admin Add Program Delete Program Edit Program Create User Delete User Update User Search for Programs Display Program Detail Apply Online Shutdown
SAMS/User Mgmt Add Program SAMS Delete Program Admin SAMS Staff Edit Program SAMS/Program Mgmt SAMS Staff SAMS/User Mgmt Create User Delete User SAMS Admin Update User Start Up Software engineering principle applied: separation of concerns divide and conquer Shutdown Search for Programs Display Program Detail Apply Online SAMS/End User SAMS End User SAMS/Authentication Login Logout SAMS End User SAMS Admin SAMS Staff
Verify the Use Cases Identified Ask questions about each use case: (1) Is it a business process? (2) Is it initiated by an actor? (3) Does it end with the actor? (4) Does it accomplish something useful for the actor? All the answers to above questions must be “yes”
Example: Library System Requirements of a library system: R1. The library system must allow a patron to check out documents. R2. The library system must allow a patron to return documents. system actor use case Use Case Business Process? Begin w/ Actor? End w/ Actor? Useful Task for Actor? Use Case? Actor System Checkout Document Library System R1 Y Y Y Y Y Patron R2 Return Document Y Patron Library System
Example: Oversea Exchange Program R1. The web-based application must provide a search capability for overseas exchange programs using a variety of search criteria. R2. The web site must provide a hierarchical display of the search results to facilitate user navigation from a high level summary to details about an overseas exchange program. System Actor Use Case? Useful Task for Actor? End w/ Actor? Begin w/ Actor? Business Process? Use Case R1 Search for Programs Y User Web App. R2 Display Program Details
Requirements Use Case Tractability Will the system satisfy all the requirements? Are any use case missing? Are any use case not needed? Which requirements are more important than the other? Which use cases should the developer focus on timely delivery?
Requirements-Use Case Traceability Matrix UC1 UC2 UC3 UC4 UC5 UC6 PriorityWeight Score 3 2 1 X 5
Project Planning by Use Cases 1) Identify dependencies between the use cases: use cases are business processes business processes depend on each other 2) Compute a partial order to develop the use cases according to the dependencies. 3) Schedule the development according to the partial order begin with higher priority use cases (risky, high-value, architecturally significant, and executable) time-boxed iterations
Project Planning with Use Cases 1 2 3 4 5 6 7 8 9 10 11 12 UC1 UC2 UC3 UC4 UC5 UC6 UC7 UC29 UC30 X ... A planning tool to let the development team know which use cases to be developed by what time which use cases are ready for integration and system testing what is the status or configuration of the project
Actor-System Interaction Modeling Specify how the system interacts with the actors to carry out the use cases. to identify what is expected from the system In an expanded use case
Expanded Use Case – Initiate a Call Actor: Caller System: Telco actor input & actor action 1.the caller picks up the handset from the phone base. system response 2. the system generates a dial tone. 3. the caller dials each digit of the phone number. 4. the system responds with a DTMF tone for each digit dialed. 5. the caller finishes dialing. 6. he system produces the ring tone. 7. the caller hears the ring tone.
Domain Model and Use Cases Part of Domain Model Program name type department institution subject region country language term Student Staff Application student_name year date_applied status manage 1..* * with name, type, department, ...
Expanded Use Case – Add Program Precondition: Staff User has logged into System and Staff Main Page is shown Actor: Staff User System: SAMS 0. System displays the staff main page. 1. TUCBW the staff user clicks the “Add Program” button. 2. System displays the Add Program page. 3. The staff user enters program detail and clicks the ”submit" button. 4. System checks the submitted info and shows a confirmation message if no error is found. 5. TUCEW the staff user clicks the “OK” button on the confirmation page. Postcondition: The added program is immediately available for search.
Showing User Interface Prototypes Showing user interface prototypes with expanded use case specification is extremely useful to obtain user feedback early in the lifecycle. These user interface prototypes may be reused in the preparation of the user’s manual, which can take place concurrently with the development effort.
Showing UI Prototypes w/ Expanded Use Case (7) TUCEW staff member is shown a message that the program has been successfully added. (6) The System updates the database with the new program details and displays a success message. (5) User fills the form and clicks on submit button. (4) System shows the Add Program Form (3) Staff member clicks on Add Program link. (2) System shows the submenu consisting of various operations that a staff user can do under Program Management. (1) TUCBW staff member clicks on Program Management link on welcome page. System : SAMS Actor : Staff User
Video Store Use Case Diagram
Banking System Use Case Diagram
Validate PIN Use Case
Withdraw Funds Use Case
Class Exercise What are the use cases for the Vending Machine?
Class Exercise: The Vending Machine The Vending Machine has a display, an alphanumeric keypad, a coin insertion slot, and an item dispenser. The display shows the vending items like chocolates, candies, potato chips, Coke, sprite, etc. Each type of item has a price and a label consisting of a letter A, B, C, ... and a digit 1, 2, ... A customer inserts coins through the coin slot. Each time a coin is inserted an LCD displays the total amount. The customer can press a letter and a digit to enter his selection after enough coins have been inserted. If the total amount is greater than or equals to the item selected, the vending machine dispenses the item and returns the change to the customer. A customer can change his mind and request that the coins be returned by pressing the return button.