Use Cases and ScenariosWe Will CoverWhat is a Use-CaseUser Goals versus User InteractionsGoals and InteractionsPoint of Sale Terminal (POST)Use-Case Diagrams (POST)Another ExampleIncludes/UsesExtendsSetting the System BoundaryA Different BoundaryPartial POSTPOST Use-CasePOST Expanded Use-CaseThe Home Heating SystemHome Heating Use-Case DiagramHome Heating Use-CasesModified Home HeatingHACSHACS Use-Case DiagramHACS Use-CasesAlternate HACSWhen to use Use-CasesCSE870: Advanced Software Engineering: UML-- Use Cases1RRRUse Cases and ScenariosCSE870: Advanced Software Engineering: UML-- Use Cases2RRRWe Will Cover•What is a use-case–Use-case versus user interaction•Use-Case diagrams–The constructs in the use-case diagrams•Capturing the use-case –High-level use-case–Extended use-case–Difference between use case and scenarioCSE870: Advanced Software Engineering: UML-- Use Cases3RRRWhat is a Use-Case•A use-case captures some user visible function•This may be a large or small function–Depends on the level of detail in your modeling effort•A use-case achieves a discrete goal for the user•Examples–Format a document–Request an elevator•How are the use cases found (captured or elicited)?CSE870: Advanced Software Engineering: UML-- Use Cases4RRRUser Goals versus User Interactions•Consider the following when formatting a document•Define a style•Change a style•Copy a style from one document to the next–versus•Format a document•Ensure consistent formatting of two documents•The latter is a user goal–Something the user wants to achieve•The former are user interactions–Things the user does to the system to achieve the goalCSE870: Advanced Software Engineering: UML-- Use Cases5RRRGoals and Interactions•There is a place for both goals and interactions•Understand what the system shall do–Capture the user goals•Understand how the user will achieve the goals–Capture user interactions–Sequences of user interactions•Thus, start with the user goals and then refine the user goals into several (many) user interactionsCSE870: Advanced Software Engineering: UML-- Use Cases6RRRPoint of Sale Terminal (POST)•Computerized system to record sales and handle payments•Typically used in a retail store•Includes HW components, such as computer and bar code scanner•Software to run the system•Goals of system:–Increase checkout automation–fast and accurate sales analysis–automatic inventory controlCSE870: Advanced Software Engineering: UML-- Use Cases7RRRUse-Case Diagrams (POST)CustomerCashierBuy ItemLog InRefund a Purchased ItemPOSTUse CaseSystem BoundaryAdapted from Larman “Applying UML and Patterns”POST: Point of Sale TerminalCSE870: Advanced Software Engineering: UML-- Use Cases8RRRSalespersonTraderAccounting SystemTrading ManagerSet LimitsUpdate AccountsAnalyze RiskPrice DealCapture DealLimit ExceededValuation«includes»«includes»«extends»Another ExampleAdapted from Fowler “UML Distilled”Financial Trading SystemCSE870: Advanced Software Engineering: UML-- Use Cases10RRRIncludes/Uses•You have a piece of behavior that is similar across many use cases•Break this out as a separate use-case and let the other ones “include” it•Examples include–Valuation–Validate user interaction–Sanity check on sensor inputs–Check for proper authorizationCSE870: Advanced Software Engineering: UML-- Use Cases11RRRExtends•A use-case is similar to another one but does a little bit more•Put the normal behavior in one use-case and the exceptional behavior somewhere else–Capture the normal behavior–Try to figure out what can go wrong in each step–Capture the exceptional cases in separate use-cases•Makes it much easier to understandCSE870: Advanced Software Engineering: UML-- Use Cases12RRRC u s t o m e rC a s h i e rB u y I t e mL o g I nR e f u n d a P u r c h a s e d I t e mP O S TM HSetting the System Boundary•The system boundary will affect your actors and use-casesAdapted from Larman “Applying UML and Patterns”CSE870: Advanced Software Engineering: UML-- Use Cases13RRRCustomerBuy ItemRefund a Purchased ItemStoreA Different Boundary•Let us view the whole store as our systemAdapted from Larman “Applying UML and Patterns”CSE870: Advanced Software Engineering: UML-- Use Cases14RRRPartial POSTC u s t o m e rC a s h i e rB u y I t e mL o g I nR e f u n d a P u r c h a s e d I t e mP O S TS t a r t U pM a n a g e U s e r sA n d a L o t M o r eM a n a g e rS y s t e m A d m i n i s t r a t o rM HAdapted from Larman “Applying UML and Patterns”CSE870: Advanced Software Engineering: UML-- Use Cases15RRRPOST Use-CaseUse case: Buy ItemActors: Customer (initiator), CashierType: PrimaryDescription: The Customer arrives at thecheckout with items to purchase.The Cashier records the purchaseitems and collects a payment.On completion the Customerleaves with the itemsCSE870: Advanced Software Engineering: UML-- Use Cases16RRRPOST Expanded Use-CaseUse case: Buy ItemActors: Customer (initiator), CashierType: Primary and essentialDescription: The Customer arrives at the checkout with items to purchase. The Cashier records the purchaseitems and collects a payment. On completion the Customer leaves with the items.Cross Ref.: Requirements XX, YY, and ZZUse-Cases: Cashier must have completed the Log In use-caseCSE870: Advanced Software Engineering: UML-- Use Cases17RRRFuel Valve9080706050OnOffControllerBurnerWater PumpHot WaterFuelTemp SensorWater ValveControl PanelHomeThe Home Heating SystemCSE870: Advanced Software Engineering: UML-- Use Cases18RRRHome Heating Use-Case DiagramH o m e O w n e rM HP o w e r U pP o w e r D o w nC h a n g e T e m p .H o m e H e a t i n gCSE870: Advanced Software Engineering: UML-- Use Cases19RRRHome Heating Use-CasesUse case: Power UpActors: Home Owner (initiator)Type: Primary and essentialDescription: The Home Owner turns the power on. Each roomis temperature checked. If a room is below thethe desired temperature the valve for the room is opened, the water pump started, the fuel valveopened, and the burner ignited. If the temperature in all rooms is above the desiredtemperature, no actions are taken. Cross Ref.: Requirements XX, YY, and ZZUse-Cases: NoneCSE870: Advanced Software Engineering: UML-- Use Cases20RRRModified Home HeatingHome OwnerMHPower UpPower DownChange Temp.Home HeatingAdjust TempTemp. HighTemp.
View Full Document