Use Cases 1 Roles of Use Cases A use case is a set of activities that produce some output result Describes how the system reacts to an event that triggers the system Trigger -- event that causes the use case to be executed Event-driven modeling – everything in the system is a response to some triggering event 2 Modeling Use Cases Complete piece of functionality Main flow/Main success scenario Subflows Extensions/Alternate flows 3 Role of Use Cases All possible responses to the event are documented Use cases are helpful when the situation is complicated 4 Sample Format for a Written Use Case Title – descriptive name, matches name in use case diagram Primary actor – usually a user role Stakeholders – any group or individual with an interest in the function of the use case Precondition – conditions that must be satisfied in order to execute the use case 5 Sample Format for a Written Use Case - 2 Minimal guarantee/Postcondition – outputs that can be expected if the service attempt failed Success guarantee/Postcondition – outputs that can be expected if the service succeeds Trigger – an event or action that initiates the use case Main success scenario – description of sequence of interactions between actor and use case during the use case execution Extensions – detailed description of how errors are dealt with 6 A sample written use case 7 Building Use Cases 8 Step 1: Identify the major use cases Activities Start a use case form for each use case If more than nine, group into packages 9 Typical Questions Asked Ask who, what, and where about the tasks and their inputs and outputs: What are the major tasks performed? What triggers this task? What tells you to perform this task? What information/forms/reports do you need to perform this task? Who gives you these information/forms/reports? What information/forms/reports does this produce and where do they go? Sample List of Events-Actions Based on Requirements Definition 10 Step 2: Identify the major steps within each use case 11 Activities Typical Questions Asked For each use case, fill in the major steps needed to process the inputs and produce the outputs Ask how about each use case: How do you produce this report? How do you change the information on the report? How do you process forms? What tools do you use to do this step (e.g., on paper, by email, by phone)? Step 3: Identify elements within steps Activities For each step, identify its triggers and its inputs and outputs 12 Typical Questions Asked Ask how about each step How does the person know when to perform this step? What forms/reports/data does this step produce? What forms/reports/data does this step need? What happens when this form/report/data is not available? Step 4: Confirm the use case Activities Typical Questions Asked For each use case, Ask the user to execute the process using the validate that it is correct written steps in the use case – that is, have the and complete user role-play the use case 13 Summary Use cases contain all the information needed for process modeling, but are easier for users to comprehend Use cases are created in an iterative cycle of steps until they are considered accurate and complete 14 Exercise: Use Cases Document four use cases from your project (the most important ones): • two from an end-user perspective • two from an administrator perspective Think about the main and alternative flows. Think about the “happy case”. 15