Use Cases and Scenarios
We Will Cover What is a use-case Use-case versus user i teractio Use-Case diagrams The co structs i the use-case diagrams Capturi g the use-case High- eve use-case Exte ded use-case Differe ce bet ee use case a d CSE 435: Software sce ario Engineering
What is a Use-Case A use-case captures some user visib e fu ctio This may be a arge or sma fu ctio Depe ds o the eve of detai i your mode i g effort A use-case achieves a discrete goa for the user Examp es Format a docume t Request a e evator Ho are the use cases fou d (captured or e icited)?
User Goals versus User Interactions Co sider the fo o i g he formatti g a docume t o Defi e a sty e o Cha ge a sty e o Copy a sty e from o e docume t to the ext versus o Format a docume t o E sure co siste t formatti g of t o docume ts The atter is a user goa Somethi g the user a ts to achieve The former are user i teractio s Thi gs the user does to the system to achieve the goa
Goals and Interactions There is a p ace for both goa s a d i teractio s U dersta d hat the system sha do Capture the user goa s U dersta d ho the user i achieve the goa s Capture user i teractio s Seque ces of user i teractio s Thus, start ith the user goa s a d the refi e the user goa s i to severa (ma y) user i teractio s
Use-Case Diagrams (POST) POST: Point of Sale Terminal System Boundary POST Use Case Buy Item Log In Cashier Refund a Purchased Item Customer Adapted from Larman Applying UML and Patterns
Another Example Financial Trading System Set Limits Update Accounts Accounting System Trading Manager Analyze Risk Price Deal «includes» «includes» Valuation Trader Capture Deal «extends» Salesperson Adapted from Fowler UML Distilled Limit Exceeded
Includes and Extends I c udes You have a piece of behavior that is simi ar across ma y use cases Break this out as a separate use-case a d et the other ones includes it Examp es i c ude o Va uatio o Va idate user i teractio o Sa ity check o se sor i puts o Check for proper authorizatio Exte ds A use-case is simi ar to a other o e but does a itt e bit more Put the orma behavior i o e use-case a d the exceptio a behavior some here e se o Capture the orma behavior o Try to figure out hat ca go ro g i each step o Capture the exceptio a cases i separate use-cases Makes it a lot easier to u dersta d
Setting the System Boundary The system bou dary i affect your actors a d use-cases Adapted from Larman Applying UML and Patterns
A Different Boundary Let us vie the ho e store as our system Store Buy Item Refund a Purchased Item Customer Adapted from Larman Applying UML and Patterns
Partial POST POST Buy Item Log In Cashier Refund a Purchased Item Customer Start Up Manage Users Manager System Administrator Adapted from Larman Applying UML and Patterns And a Lot More
POST Use-Case Use case: Actors: Type: Description: Buy Item Customer (i itiator), Cashier Primary The Customer arrives at the checkout ith items to purchase. The Cashier records the purchase items a d co ects a payme t. O comp etio the Customer eaves ith the items
POST Expanded Use-Case Use case: Actors: Type: Description: Buy Item Customer (i itiator), Cashier Primary a d esse tia The Customer arrives at the checkout ith items to purchase. The Cashier records the purchase items a d co ects a payme t. O comp etio the Customer eaves ith the items. Cross Ref.: Requireme ts XX, YY, a d ZZ HERE Use-Cases: Cashier must have comp eted the Log I use-case
Home Heating System Image: http://www.heatingoil.com/ Image: http://www.homeheatingdr.com/
Home Heating System Temp Sensor Water Pump Water Valve Fuel Valve Hot Water Burner Controller Home 90 80 Off Fuel 70 On 60 50 Control Panel Temp Sensor
Home Heating Requirements The purpose of the software for the Home Heating System is to control the heating system that heats the rooms of a house. The software shall maintain the temperature of each room within a specified range by controlling the heat flow to individual rooms. The soft are sha co tro the heat i each room The room sha be heated he the temperature is 2F be o desired temp The room sha o o ger be heated he the temperature is 2F above desired temp The f o of heat to each room sha be i dividua y co tro ed by ope i g a d c osi g its ater va ve The va ve sha be ope he the room eeds heat a d c osed other ise The user sha set the desired temperature o the thermostat The operator sha be ab e to tur the heati g system o a d off The fur ace must ot ru he the system is off
Home Heating Requirements The purpose of the software for the Home Heating System is to control the heating system that heats the rooms of a house. The software shall maintain the temperature of each room within a specified range by controlling the heat flow to individual rooms. Whe the fur ace is ot ru i g a d a room eeds heat, the soft are sha tur the fur ace o To tur the fur ace o the soft are sha fo o these steps ope the fue va ve tur the bur er o The soft are sha tur the fur ace off he heat is o o ger eeded i a y room To tur the fur ace off the soft are sha fo o these steps c ose fue va ve tur bur er off
Home Heating Use-Case Diagram Home Heating Power Up Home Owner Power Down Change Temp.
Home Heating Use-Cases Use case: Power Up Actors: Home Owner (initiator) Type: Primary and essential Description: The Home Owner turns the power on. Each room is temperature checked. If a room is below the the desired temperature the valve for the room is opened, the water pump started. If the water temp falls below threshold, the fuel valve is opened, and the burner ignited. If the temperature in all rooms is above the desired Cross Ref.: Use-Cases: temperature, no actions are taken. Requirements XX, YY, and ZZ None
Modified Home Heating Home Heating Power Up «includes» Temp. High Home Owner Power Down Change Temp. Adjust Temp «includes» «includes» «includes» Temp. Low
Modified: Home Heating Use-Cases Use case: Actors: Type: Power Up Home Owner (initiator) Primary and essential Description: The Home Owner turns the power on. Perform Adjust Temp. If the temperature in all rooms is above the desired temperature, no actions are taken. Cross Ref.: Use-Cases: Requirements XX, YY, and ZZ Perform Adjust Temp
Modified: Home Heating Use-Cases Use case: Actors: Type: Adjust Temp System (initiator) Secondary and essential Description: Check the temperature in each room. For each room below target, open room valve, start pump if not started. If water temp falls below threshold, open fuel value and ignite burner. Cross Ref.: Use-Cases: Requirements XX, YY, and ZZ Temp-Low, Temp-high
When to use Use-Cases I short, a ays!!! Requireme ts is the toughest part of soft are deve opme t Use-Cases is a po erfu too to u dersta d o Who your users are (i c udi g i teracti g systems) o What fu ctio s the system sha provide o Ho these fu ctio s ork at a high eve Spe d adequate time o requireme ts a d i the e aboratio phase