1 / 52

Chapter 6

Use Cases. Chapter 6. What is a Use Case?. A Use Case is a text story of some actor using a system to meet one or more goals (or not). Basic Use Case Components :. Use Case Diagrams are light on detail Text Use Cases contain most of the requirements

ifeoma-head
Download Presentation

Chapter 6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Use Cases Chapter 6

  2. What is a Use Case? A Use Case is a text story of some actor using a system to meet one or more goals (or not).

  3. Basic Use Case Components: • Use Case Diagrams are light on detail • Text Use Cases contain most of the requirements • Use Case Diagrams show only high-level goals • Text Use Cases flesh out the details • Use Cases focus on what user needs are to be fulfilled

  4. Fig. 6.1 A sale consists of selling one or more items ? Use Case Tools

  5. Example: (POS) brief format use case Process Sale: A customer arrives at a checkout with items to purchase. The cashier uses the POS system to record each purchased item. The system presents a running total and line-item details. The customer provides payment information, which the system validates and records. The system updates inventory. The customer receives a receipt and leaves the store.

  6. Definitions: • Actor: Something with behaviour; person (playing role), computer system or organization • Scenario: Sequence of actions and interactions between actors and system. Also called use case instance. Just one story of usage, among many. • Use Case: Collection of related success and failure scenarios.

  7. Use Case (Casual Format): typical situation where main scenario is easy but exceptions make all the work • Handle Returns: • Success: • Customer arrives at POS with item to return. Cashier uses POS system to record return. • Alternative Scenarios: • Unreturnable: Item was unreturnable due to special sale conditions. • Failed Credit: Customer paid with credit card but card won’t accept return so pay in cash. • Unknown Item: Computer can’t find item code, enter by hand • System Down: Use receipt book to hand-return item.

  8. Use-Case Model (UP def’n): • Collection of Use Cases within the Requirements discipline. • Not the only UP Requirements artifact: Supplementary Specification, Glossary, Vision, Business Rules (p 101) • Use Case Diagrams just for added context. • Nothing OO about Use Cases.

  9. Why Bother? • Focusing on user goals early on keeps you looking at “what” and not “how” too soon. • Customers understand their goals more than how a computer system may help meet them. • Domain experts can contribute. • User-centric; this is good since this is a document a user may very well see. • Use Case strength is its ability to scale up or down in terms of level of detail.

  10. Are Use Cases Functional Requirements? • Yes, they describe what a system is supposed to do. • A Use Case is a contract on how a system should behave. • FURPS+ (p56) • Use Cases are not a “features list”.

  11. Three Kinds of Actors: • Primary: Has goals fulfilled by using the system. Generally drives the Use Case definition • Supporting: Provides a service to a system. Example, credit card check for POS. Often a computer system. • Offstage: Has an interest but only indirectly (NYSTax)

  12. Three Use Case Formats: • Brief: One-paragraph summary (with title). We will use WikiTitles (AllOneWordWithCapitals) since these are also Wiki links. • Casual: Multiple, short paragraphs describing various scenarios. • Fully Dressed: All steps and variations in detail. NOTE: After first Requirements Workshop only 10% of Use Cases are “fully dressed”. Other Use Cases are briefly or casually described.

  13. Fully Dressed Use Case Format

  14. Fully Dressed Use Case (1): • Scope: NextGenPOSApplication • Level: User Goal • PrimaryActor: Cashier • StakeholdersAndInterests: • cashier wants: … • customer wants: … • company wants: … • manager wants: … • government wants: … • CC company wants: …

  15. Fully Dressed Use Case (2): • Preconditions: Cashier identified and authenticated • Postcondtions: Sale completed, tax calculated, inventory updated, commission recorded, cc approval recorded • MainSuccessScenario: • Customer arrives with goods • Cashier starts new sale • Cashier enters item identifier • Systems records sale and presents description and running total (repeat 3-4 many times) • System presents total • …

  16. Fully Dressed Use Case (3): • Extensions: … • 2-4a: Customer tells Cashier of tax-exempt status • Cashier verifies, enters tax-exempt code • System records tax-exempt status of sale. … • SpecialRequirements: • touch screen • cc authorization in 30 seconds or less • robustness of remote system (inventory) fails • internationalizable • …

  17. Fully Dressed Use Case (3): • TechnologyAndDataVariations: • manager override is card swipe or keyed entry • item ID is bar coded or keyed in • cc uses card reader or keyboard • signature on paper receipt • Frequency: • All the time. • OpenIssues: • tax law variations • remote service recovery issue • business customization

  18. Section Meanings: • Scope: system boundary; two broad types of scope – system and business. • Level: level of detail; user or sub-function. • User level corresponds to elementary business process (EBP). • Sub-function level supports some user level goal and factors out otherwise redundant description. • Actor: Who asks the system to fulfil this goal? • Stakeholders: Those interested in the system. System implements a contract with stakeholders. What should be in a use case? That which satisfies all stakeholders’ interests

  19. Section Meanings (2): • Preconditions and Success Guarantees: Keep to the non-obvious. Otherwise, it is just “noise”. • preconditions: what is true before each instance of the use case • postconditions: always true on success. • Main Success Scenario: The “happy path”. This often has no branches. Put conditions in Extension section. Bullets in this section record: • an interaction between actors (system also an actor) that gets the scenario started • a validation • a state change

  20. Section Meanings (3): • Extensions: • Most of the text. • All the special cases. • Failure situations put here. • “Most” stakeholder concerns either here or in Main. (Non-functional requirements elsewhere) • Be direct in your expression; not inferential or vague • Complex extensions can become separate use cases. • Notation: • 4a is an exception for main scenario 4. • 3-6a extension can happen in main scenario steps 3-6. • *a can happen in every main scenario step. • Subsections of an extension section are “mini”-use cases.

  21. Section Meanings (4): • Special Requirements: This is the place for non-functional requirements, quality attributes or constraints. Include performance, reliability, usability, etc. • Technology and Data Variations: • Specify alternatives such as “print to file or printer”. • Specify the data formats, for example “data exchanged in XML”. • Can express future plans for the system.

  22. Use Cases: Written and Wrong!! • Because of the iterative, evolutionary, time-boxed versus waterfall approach, initial use case are always “wrong” because they are always “incomplete”. • Fill out your understanding when coding. • Good reason for not using Waterfall.

  23. Questions of Style (Essential Use Cases): • The user says she needs to “log in”, meaning userID and password; you describe this as “authentication and authorization”. Don’t be more specific than you need to be. • Results on use cases at right level of abstraction. • Use cases should express “goals” not “means”. • Use cases should express user “intentions” and system “responsibilities”, not concrete actions. • Use cases are a “design” document; too early to get bogged down in details. • This style results in black-box use cases – use cases that describe what but not how. • “How” includes UI details; to be avoided.

  24. An Actor-Goal Approach: • Use cases should always perform an action that results in something useful for the primary actor. • This guarantees that your write the use case at the appropriate level. • Compare this to the “feature and function” list of the 1970s. • Does it ever hurt to focus on what the customer values? • Remember we are still early and still talking to the customer a lot; shouldn't get into implementation strategies.

  25. system actors, both primary and secondary How to Find Use Cases: • Remember, use cases satisfy goals of primary actors so: • choose a system boundary and identify the primary actors (often brainstorming the actors highlights the system boundaries) • identify their goals vis-à-vis this system • define the use cases that achieve those goals

  26. Questions to Ask Yourself When Looking for Actors/Goals: • Who starts and stops the system? • Who does user and security management? • Who does system administration? • Is “time” an actor? Is the system event driven? • Is the system monitored (cron job)? • How about updates? • Are their non-human primary actors (other systems)? • Who evaluates performance and activity? • Who looks at the logs? • Who gets notified on error?

  27. Organizing Actors and Goals • Draw a little picture (Use-Case Diagram) for each (Actor,Goal) pair or make a list of actors and goals • What goes in the picture? system boundary, primary and secondary actors, their goals; ie, the essence of a Use-Case.

  28. Why focus on Actors and Goals? • Don’t ask an actor “What do you do?”, ask “What are your goals?” • “What do you do?” will illicit answers that • describe how they do things, not what they do. • describe current practices not long-term needs • “What are your goals?” will illicit answers that • offer the opportunity to think of new and improved solutions • focus on business value, not business function • get to the heart of what stakeholders want • give more opportunity for developer creativity

  29. Example: Worker Punch Clock System Replacement

  30. Potential Solutions • Computerized login/passwd screen. • Employee ID card magnetic strip reader • Biometric palm reader Only the “goals” approach directly lead us to the third solution.

  31. system boundary Fig. 6.2 some actors are other systems some actors are “offstage” Why is the customer not the primary actor for the POS system? Depends on system boundary.

  32. Alternatives for Finding Actors/Goals/Use Cases: • Start with an External Event Analysis. Responding to external events is what systems do. • One use case per user goal • Use Case names should be wiki names starting with a verb • Exception: insert/update/delete are grouped as one use case – manage().

  33. Use Case Tests: • Boss Test: Especially for the “architecturally significant” use cases, your boss should think this is essential to the business. • EBP Test: An Elementary Business Process is defined as • Size Test: Use cases that you can express in less than a page are often not significant. Fully-dressed use cases take 3-10 pages to explain. A task performed by one person in one place at one time, in response to a business event, that adds measurable value to the business and leaves business data in a consistent state.

  34. Exercise: • Test the following possible use cases: • negotiate a supplier contract • handle returns • log in • move pieces on a game board

  35. Exercise: • Test the following possible use cases: • negotiate a supplier contract • broader and longer than an EBP, “business” not “system” use case • handle returns • Boss, EBP and Size all seem to fit • log in • never keep boss happy • move pieces on a game board • too big

  36. Fig. 6.3 A Use Case Diagram: Actors (primary and secondary), System Boundary and Goals

  37. Fig. 6.4

  38. Fig. 6.5 Alternative Notational Systems An explanatory note; ULM provides for these

  39. Activity Diagrams: • A UML diagram for visualizing workflows and business processes. • Show the inter-relatedness of various use cases • page 477

  40. Fig. 28.1

  41. Fig. 28.7 actors actions control flow objects data flow

  42. Motivation: • Focusing on user goals: • keeps the user happy. • keeps you from writing a long features list. • Writing a use case in a context of a typical scenario • keeps you working at the right level • aids in cohesion and reduces coupling Example: In an Inventory System we have Product and Inventory objects and the job of adding a product to inventory. Where to we put the responsibility of adding the Product? Does a Product add itself? Is the Inventory system responsible for adding things to itself?

  43. An Aside: A highly cohesive, lowly coupled system Train-RailCar Example: add() method; where does it go? This is a “responsibility” question.

  44. An Aside (continued): An uncohesive, highly coupled system

  45. One Final Note: • The author says that some times a Use Case point-of-view is not always easy to come up with. In particular, for application servers, database back-ends and other middleware. • This is unfortunate since a lot of work being done today is done on these kinds of back-end systems. • However, many back-end activities are in support of front-end activities and so the front-end use cases can be an indirect guide to how these back-ends should evolve. • As well, even back-end systems benefit from being developed, first from a point-of-view of “what” needs to be accomplished and only later, “how” to do that.

  46. Fig. 6.6 Monopoly Use Case Diagram

  47. Monopoly Use Case Text: • Scope: Monopoly Application • Level: User Goal • Primary Actor: Observer • Stakeholders: Observer; easily observe game simulation output • Main Scenario: • Observer requests new simulation, enters num players • Observer starts play. • System displays game trace after each play • Repeat 3. until game over or Observer cancels

  48. Monopoly Use Case Text: • Extensions: • *a: At any time, system fails (System logs each move) • Observer restarts system • System detects failure and reconstructs correct state, continues • Observer chooses to continue • Special Requirements: • Provide graphical and text trace modes

  49. Use Cases and Iterative Methods: • Functional requirements recorded in Use Cases • In each iteration some Use Cases are developed, partially or completely. • Use Case realizations drive the design and development. • Use Cases influence documentation design • Functional and system testing corresponds to Use Case Scenarios • Development environment UIs are created to manage the most important Use Case scenarios

  50. Use Case Evolution across Iterations: Two more phases: Construction and Transition

More Related