Use Case Modeling - techniques for detailing use cases Chapter 5 pp: 132-142, 146-148 Use Case Descriptions Activity Diagrams (also read Ch2: 60-63) CRUD Analysis
Outline Describing Use Cases in more detail Use Case Descriptions Activity Diagrams also read Ch2: 60-63 Validating Use Cases – using CRUD Analysis
Use Case Description Describes the details for a given use case Various levels of details Brief (Ch 3) Intermediate Fully developed ATM System Withdraw cash Use Case Description (brief version) Actor inserts a bank card and PIN, and the system sends the account number and PIN number to the bank for verification. Actor enters a withdrawal amount, and the system requests the bank’s authorization, creates a transaction record, and dispensing cash.
Use Case Description – “Brief” Create Customer account Customer Use Case Description “Brief”
Use Case Description – “Fully Developed” Create Customer account Customer
Use Case Description – “Fully Developed” Use case name – e.g. Create Customer Account Scenario – unique path through this use case (Create Online Customer Account) Triggering event – external, temporal, state Brief description – summary of Flow of Activities Actors – actual user(s) Related use cases – includes or extends Stakeholders – vested interest Preconditions – any object/system that must be available before the use case Post conditions – objects/associations created/updated during the use case Flow of activities – actor and system swimlanes showing interactions Exception conditions – what prevents the use case from completing
UML's Activity Diagram
UML Activity Diagram a graphical representation of procedural flow Activities People, System(s) Flow Sequential, conditional, repetition Used to model 2 things: Business Processes (BPM) -also read Ch2: 60-63 Use Case (Ch 5)
Activity Diagram – Symbols For Concurrency…. Synchronization Bar Fork Swimlane Loop contains activities performed by a single agent (actor, organizational unit) For each item Join End for each item Starting Activity Ending Activity Output cannot execute until all inflows have been received Decision Merge Activity/Action [guard] Transition/Activity Edge
Activity Diagram – Issue a Quote Use this notation for decisions - i.e. include the [guards] [guard]
Forks, Joins, and Decisions Option 1: A E D C B Option 2: F
Practice: Activity Diagram & Use Case Description Use Case Name: “Create New Sale for Contractor (on credit)” Use Case Description: A contractor initiates a purchase by taking materials to the checkout desk for contractors. The clerk enters the contractor's name into the system. The system displays the contractor's information, including his/her current credit standing. The clerk then opens up a new ticket (sale) for the contractor. Next, the clerk scans in each item to be purchased. The system finds the price of the item and adds the item to the ticket. At the end of the purchase, the clerk indicates the end of the sale. The system compares the total amount against the contractor’s current credit limit, and if it is acceptable, finalizes the sale. The system creates an electronic ticket for the items, and the contractor’s credit limit is reduced by the amount of the sale. There is an additional use case called “Create a New Cash Sale”.
Practice: Activity Diagram
Practice: Use Case Description Use case name Create a New Sale Scenario Creating a new sale for contractors (on credit) Triggering event Contractor wants to purchase items Brief description Contractor bring items to checkout desk. Clerk validates his account and credit limit. Clerk scan items. System looks up price, records items, and compares total to credit limit. The system creates a ticket with all items and reduces the credit limit. A ticket is printed upon request. Actors Clerk Related use cases None: includes or extends Stakeholders Sales clerk, Sales department, Accounting department Preconditions Account must exist; Inventory items must exist Post conditions Sale is created, Sale line items are created and connected to the sale. Account is updated, Inventory is reduced Flow of activities Actor System Clerk enters customer name Clerk scans items Clerk indicates end of the sale 1.1 System validates account 2.1 System creates a Sale 2.2 System looks up item 2.3 System adds item to Sale 3.1 System calculates total amount 3.2 System reduces credit limit Exception conditions 1.1 If account is out of balance, initiate "Create a New Cash Sale" use cases 2.2 If item is not found, clerk calls manager and manually enters item information 3.1 If amount is greater than credit limit, initiate "Create a New Cash Sale" use case
Validating Use Cases - CRUD Analysis Can be a tool for: use case identification and/or validation Ensure that there are use cases to cover the CRUD CRUD - For 1 data entity C R U D CRUD Matrix All use cases All data entities Shows responsibilities
CRUD CRUD Use Cases Place order Change order Cancel order Print order report Update customer profile View order status … Order C Create R Read U Update D Delete CRUD Matrix Use Cases Order OrderItem Customer Item Place order Update Customer Profile …