Use Case Tutorial Use Case 1 What is

  • Slides: 18
Download presentation
Use Case Tutorial Use Case - 1

Use Case Tutorial Use Case - 1

What is Use Case Modeling? A a view of a system that emphasizes the

What is Use Case Modeling? A a view of a system that emphasizes the behavior as it appears to outside users. A use case model partitions system functionality into transactions (i. e. , use cases) that are meaningful to users (i. e. , actors). • System behavior is how a system acts and reacts. – It is an outwardly visible and testable activity of a system. • System behavior is captured in use cases. – Use cases describe the system, its environment, and the relationship between the system and its environment. Use Case - 2

Usages of a Use Case Model Use Case - 3

Usages of a Use Case Model Use Case - 3

What Are the Benefits of Use-Case Models? • Used to communicate with the end

What Are the Benefits of Use-Case Models? • Used to communicate with the end users and domain experts – Provides buy-in at early stages of development – Insures a mutual understanding of the requirements • Used to identify – Who interacts with the system and what the system should do – The interfaces the system should have • Used to verify – All requirements have been captured – The development team understands the requirements Use Case - 4

System Surroundings and Actors • Users who execute the system’s – Main functions –

System Surroundings and Actors • Users who execute the system’s – Main functions – Secondary functions, such as system administration • External hardware that the system uses • Other systems interacting with the system Use Case - 5

Use Cases and Actors • A use case models a dialog between actors and

Use Cases and Actors • A use case models a dialog between actors and the system. • A use case is initiated by an actor to invoke a certain functionality in the system. a use case: . . . describes a sequence of actions, performed by a system, that yields a result of value to the user. Use Case - 6

Develop a Library System Use Cases Exercise • Identify actors • Determine major use

Develop a Library System Use Cases Exercise • Identify actors • Determine major use cases • Draw a use case diagram The library system is designed for a local public library. Use Case - 7

Verify Use-Case Specifications • Is it clear who wishes to perform a use case?

Verify Use-Case Specifications • Is it clear who wishes to perform a use case? Is the purpose of the use case also clear? • Does the brief description give a true picture of the use case? • Is it clear how and when the use-case's flow of events starts and ends? • Does the communication sequence between actor and use case conform to the user's expectations? • Are the actor interactions and exchanged information clear? Does the use-case contain any superfluous behavior? • Are any use cases overly complex? • Is the use-case unambiguous? Use Case - 8

Create and Verify a Glossary • Does each term have a clear and concise

Create and Verify a Glossary • Does each term have a clear and concise definition? • Is each glossary term included somewhere in the use-case descriptions? • Are terms used consistently in the brief descriptions of actors and use cases? Use Case - 9

Library System Use Case Exercise A library contains books and journals. The task is

Library System Use Case Exercise A library contains books and journals. The task is to develop a computer system for borrowing books. To borrow a book the borrower must hold a valid library card, have no books overdue by more than one week, and have no outstanding fines. There is a limit of 6 books that can be borrowed by a student and 12 books by a staff member. The library may have several copies of a given book. It is possible to reserve a book. Some books are for short term loans only. Other books may be borrowed for 3 weeks. Borrowers can extend the loans. Give a use case description for the following use case: • Borrow a copy of a book Use Case - 10

Step Wise Refinement of Use Case Model The eight basic steps to generate use

Step Wise Refinement of Use Case Model The eight basic steps to generate use cases model for each business process area: Step 1: Confirm actors and goals. Have all actors and their goals been identified? Which actors can be generalized (combined)? Which goals are potential use cases? Step 2: Develop an outline of the use case(s). For the goals identified as potential use cases, what are the key pieces? For each outline level, what are key data? Outline all use cases. Prioritize the use-case flows. Decide on a final use-case list (for initial pass). Step 3: Write a brief description of the use case(s). What two or three sentences describe all actors and the basic flow? Generate content first, and worry about wordsmithing it later. Step 4: Detail the basic flow. What event starts the use case? How does the use case end? How does the use case repeat some behavior? What is the "happy" (best case) path? There can only be one! Use Case - 11

Step Wise Refinement of Use Case Model Step 5: Detail the alternate flows. Are

Step Wise Refinement of Use Case Model Step 5: Detail the alternate flows. Are there optional situations for the use case? What might go wrong? What might not happen? Which resources might be blocked, limited, unavailable? Which alternate flows are special — perhaps nonfunctional — requirements (i. e. , they apply to this use case only)? Step 6: Review the use case(s). Are there more use cases? Should some use cases be redefined? Which ones can be combined? Step 7: Record pre- and post-conditions. What was the previous state before this use case comes into play? What happens once the use case is complete? Step 8: Develop generalizations for all use cases. Determine shared content and process for the use cases. What items have been noted for the glossary or as global business rules? Who has the most recent and accurate source document? Where is it located? Use Case - 12

Reminders • Write something readable. – Casual, readable use cases are still useful whereas

Reminders • Write something readable. – Casual, readable use cases are still useful whereas unreadable use cases won’t get read. • Work breadth-first, from lower precision to higher precision. – – Precision Level 1: Primary actors name and goal Precision Level 2: The use case brief; or the main success scenario Precision Level 3: The extension conditions Precision Level 4: The extension handling steps • For each step: – Show a goal succeeding. – Capture the actor’s intention, not the user interface details. – – Have an actor pass information, validate a condition, or update state. Write between-step commentary to indicate step sequencing (or lack of). Source: Writing Effective Use Cases by Alistair Cockburn, 2001, Addison-Wesley Use Case - 13

The Writing Process 1. Name the system scope and boundaries. Track changes to this

The Writing Process 1. Name the system scope and boundaries. Track changes to this initial context diagram with the in/out list. 2. Brainstorm and list the primary actors. Find every human and non-human primary actor, over the life of the system. 3. Brainstorm and exhaustively list user goals for the system. The initial Actor-Goal List is now available. 4. Capture the outermost summary use cases to see who really cares. Check for an outermost use case for each primary actor. 5. Reconsider and revise the summary use cases. Add, subtract, or merge goals. Double-check for time-based triggers and other events at the system boundary. 6. Select one use case to expand. Consider writing a narrative to learn the material. Source: Writing Effective Use Cases by Alistair Cockburn, 2001, Addison-Wesley Use Case - 14

Continued… 7. Capture stakeholders and interests, preconditions and guarantees. The system will ensure the

Continued… 7. Capture stakeholders and interests, preconditions and guarantees. The system will ensure the preconditions and guarantee the interests. 8. Write the main success scenario (MSS). Use 3 to 9 steps to meet all interests and guarantees. 9. Brainstorm and exhaustively list the extension conditions. Include all that the system can detect and must handle. 10. Write the extension-handling steps. Each will end back in the MSS, at a separate success exit, or in failure. 11. Extract complex flows to sub use cases; merge trivial sub use cases. Extracting a sub use case is easy, but it adds cost to the project. 12. Readjust the set: add, subtract, merge, as needed. Check for readability, completeness, and meeting stakeholders’ interests. Use Case - 15

Review Questions • • • What are the main artifacts of requirements? What are

Review Questions • • • What are the main artifacts of requirements? What are the requirements artifacts used for? What is a use-case model? What is an actor? What is a use case? What is the difference between a scenario and a use case? Use Case - 16

Use Case Modeling Tips • Make sure that each use case describes a significant

Use Case Modeling Tips • Make sure that each use case describes a significant chunk of system usage that is understandable by both domain experts and programmers • When defining use cases in text, use nouns and verbs accurately and consistently • Factor out common usages that are required by multiple use cases – If the usage is required use <<includes>> or <<uses>> – If the base use case is complete and the usage may be optional, consider use <<extends>> • A use case diagram should – contain only use cases at the same level of abstraction – include only actors who are required • Large numbers of use cases should be organized into packages Use Case - 17

Use Case Exercise • Describe a Use Case for a user who has just

Use Case Exercise • Describe a Use Case for a user who has just chosen a book at BN. com and wants to check out. – This use case should end when the user has successfully paid for the book. Use Case - 18