- Количество слайдов: 45
Use Cases Supplemental Lecture for Chapter 2 of Xiaoping Jia OOSD using Java NJIT 1
Define the Problem n n 2 The most critical question: “Is this the right system to make? ”
Use Case Relationships Business Model Objects, attributes, associations Domain Model VISION Use Case Model Requirements Design 3 GLOSSARY SUPPLEMENTARY SPECIFICATION Interaction Diagrams
Use Cases are not Diagrams n n 4 Use Cases may have a diagram associated with them, and a use case diagram is an easy way for an analyst to discuss a process with a subject matter expert (SME). But use cases are primarily text. The text is important. The diagram is optional.
Emphasize Goals n n 5 Investigating goals rather than tasks and procedures improves information gathering by focusing on the essence of requirements —the intent behind them. Seeing requirements as identifying tasks to be done has a strong bias toward reproducing the existing system, even when it is being replaced because it is seriously defective.
Why Use Cases? n n 6 Simple and familiar storytelling makes it easier, especially for customers, to contribute and review goals. Use cases keep it simple (KISS) They emphasize goals and the user perspective. New use case writers tend to take them too seriously.
Actors or Use Case First? n 7 Because you have to understand each part of Use Cases, the parts are presented separately. But those who create use cases switch back and forth. The text describes use cases substantially before paying attention to actors. Typically, both actors and use cases are identified early and then examined to see if more use cases can be found from the actors, or more actors found by examining the use cases.
Identify Use Cases n n Capture the specific ways of using the system as dialogues between an actor and the system. Use cases are used to n n n 8 Capture system requirements Communicate with end users and Subject Matter Experts Test the system
Specifying Use Cases n 9 Create a written document for each Use Case n Clearly define intent of the Use Case n Define Main Success Scenario (Happy Path) n Define any alternate action paths n Use format of Stimulus: Response n Each specification must be testable n Write from actor’s perspective, in actor’s vocabulary
www. usecases. org Template n n n n n Name Primary Actor Scope Level Stakeholders and Interests Minimal Guarantee Success Guarantee Main Success Scenario Extensions 10 n n This is the basic format used in the text and in Alistair Cockburn’s Writing Effective Use Cases (Addison Wesley, 2000, ISBN 0201702258). I prefer to modify it slightly to use the actor actions and system response in tabular form. Larman calls this the Two-Column Variation.
Optional Items n n 11 You can add some of the following items n Trigger (after Success Guarantee) (at end: ) n Special requirements n Technology and Data Variations n Frequency of Occurrence n Open Issues
SAMPLE: Fully Dressed Use Case 12
Elements in the Preface n n n 13 Only put items that are important to understand before reading the Main Success Scenario. These might include: Name (Always needed for identification) Primary Actor Stakeholders and Interests List Preconditions Success Conditions (Post Conditions)
Naming Use Cases n n n 14 Must be a complete process from the viewpoint of the end user. Usually in verb-object form, like Buy Pizza Use enough detail to make it specific Use active voice, not passive From viewpoint of the actor, not the system
Hint n n n 15 Appropriate use case names are very important. Because they are selected early, they tend to set the direction for the entire project. Most common errors in use case diagrams are poor names, showing procedures instead of complete user processes, and not including the boundary and system name. Rational Rose does not show the boundary and name, so assignments turned in using that tool do not have to have them. Rational Rose is preferred for assignments.
Golden Rule of Use-Case Names n n 16 Each use case should have a name that indicates what value (or goal) is achieved by the actor's interaction with the system Here are some good questions to help you adhere to this rule: n Why would the actor initiate this interaction with the system? What goal does the actor have in mind when undertaking these actions? What value is achieved and for which actor? From Dr. Use Case (Leslee Probasco) in the Rational Edge, March, 2001
Use Case Name Examples n n n 17 Excellent - Purchase Concert Ticket Very Good - Purchase Concert Tickets Good - Purchase Ticket (insufficient detail) Fair - Ticket Purchase (passive) Poor - Ticket Order (system view, not user) Unacceptable - Pay for Ticket (procedure, not process)
CRUD n n n 18 Examples of bad use case names with the acronym CRUD. (All are procedural and reveal nothing about the actor’s intentions. ) C - actor Creates data R - actor Retrieves data U - actor Updates data D - actor Deletes data
Singular or Plural n n n 19 This is usually determined by context. There is a preference for the simplest form, but most common form can be better. In the example of concert tickets, most people buy more than one, but a significant number buy only one. At a supermarket, Buy Items would be best. At a vending machine, it would be Buy Item.
Identify Actors n We cannot understand a system until we know who will use it n n 20 Direct users Users responsible to operate and maintain it External systems used by the system External systems that interact with the system
Specifying Actors n n n 21 Actors are external to the system Actors are non-deterministic What interacts with the system? Actors may be different roles that one individual user interacts with the system Actors may be other systems Don’t assume that Actor = Individual
Types of Actors n Primary Actor n n Has goals to be fulfilled by system Supporting Actor n Provides service to the system n Offstage Actor n Interested in the behavior, but no contribution In diagrams, Primary actors go on the left and others on the right. n 22
Define Actors should not be analyzed or described in detail unless the application domain demands it. n Template for definition: n Name n Definition n Example for an ATM application: Customer: Owner of an account who manages account by depositing and withdrawing funds n 23
Identifying Actors n n 24 Primary Actor n Emphasis is on the primary actor for the use case. Stakeholders and Interests n Other actors are listed as stakeholders. n The interests of each key actor should be described.
Working with Use Cases n n 25 Determine the actors that will interact with the system Examine the actors and document their needs For each separate need, create a use case During Analysis, extend use cases with interaction diagrams
Preconditions n n n 26 Anything that must always be true before beginning a scenario is a precondition. Preconditions are assumed to be true, not tested within the Use Case itself. Ignore obvious preconditions such as the power being turned on. Only document items necessary to understand the Use Case.
Success Guarantees n n 27 Success Guarantees (or Postconditions) state what must be true if the Use Case is completed successfully. This may include the main success scenario and some alternative paths. For example, if the happy path is a cash sale, a credit sale might also be regarded a success. Stakeholders should agree on the guarantee.
Scenarios n n 28 The Main Success Scenario, or “happy path” is the expected primary use of the system, without problems or exceptions. Alternative Scenarios or Extensions are used to document other common paths through the system and error handling or exceptions.
Documenting the Happy Path The Success Scenario (or basic course) gives the best understanding of the use case n Each step contains the activities and inputs of the actor and the system response n If there are three or more items, create a list n Label steps for configuration management and requirements traceability n Use present tense and active voice n Remember that User Interface designers will use this specification Note: Do not use the term “happy path” in formal documents. n 29
Extensions (Alternative Flows) n n 30 Extensions or Alternative Flow Use Cases allow the specification of n Different ways of handling transactions n Error processes Sections are convenient way to handle alternative courses of action n Sections are a segment of a use case executed out of sequence
Two Parts for Extensions n Condition n Describe the reason for the alternative flow as a condition that the user can detect n Handling n 31 Describe the flow of processing in the same manner as the happy path, using a numbering system consistent with the original section.
Documenting Extensions n n Use same format as Happy Path Document actions that vary from ideal path Include error conditions Number each alternate, and start with the condition: 3 A. Condition: If [actor] performs [action] the system … n n 32 If subsequent steps are the same as the happy path, identify and label as (same) Steps not included in alternate course are assumed not to be performed.
Special Requirements n 33 If a non-functional requirement , quality attribute, or constraint affects a use case directly, describe it as a special requirement.
Types of Use Cases n n 34 The most common Use Cases are High Level Use Cases and Expanded Essential Use Cases in analysis, and Expanded Real Use Cases in design. The next slide gives definitions. In addition, Use Case diagrams may be used in discussions with stakeholders while capturing their requirements.
Elaborating Use Cases n n 35 High Level Use Case (Brief) n Name, Actors, Purpose, Overview Expanded Use Case (Fully Dressed) n Add System Events and System Responses Essential Use Case (Black Box) n Leave out technological implications Real Use Case (White Box) n Leave in technology
Expanded Essential Use Cases (Fully Dressed Use Cases) n n Purpose: n to allow the system designer and client to visualize the flow of actor actions and system responses. From this the client will understand how users will use the system, and the designer will be able to write pseudocode for each function. In addition, it is possible to use this document to anticipate opportunities for user error, which must be accounted for in the final system. Definitions: n What it is: an analysis document which describes in detail the elements of functions identified in a High Level Use Case. n What is is not: Expanded Essential Use Cases are not graphical drawings. They do not include stick figures, boxes representing the system, or any other icons found in a High Level Use Case although they may be associated with one. 36
Expanded Essential Use Cases n 37 How to make one: n Step 1: Name the Use Case (system function, e. g. “enter timesheet information”). n Step 2: Identify the Actor(s) involved. n Step 3: Describe the Intent of the Use Case in language the client will understand. n Step 4: Identify the Assumptions and Limitations relevant to this Use Case and other Use Cases which the current one might extend or build upon. n Step 5: Specify the ideal flow of actions using two columns labeled “Actor Actions” and “System Responses. ” Number each step. This constitutes the Happy Path for this Use Case. n Step 6: Identify opportunities for user error and create an Alternative Path to handle each.
Postconditions n 38 Postconditions (or success guarantees) state what always must be true for a use case to succeed. Avoid the obvious, but clearly document any that are not obvious. This is one of the most important parts of a use case.
Conditions and Branching n 39 Stick to the “Happy Path, ” “Sunny Day Scenario, ” Typical Flow, or Basic Flow (all names for the same basic idea) in the main section and defer all conditional sections and branching to the extensions or alternate flows.
Warning n n n 40 Use cases should not be misused to imitate function specification by successive iteration Don’t refine them until the program is fully specified The uses relation should only be used when the same scenario is encountered more than once
Use Cases not an OO idea n n 41 Use Cases are not an Object-Oriented methodology. They are common in structured development as well. However, the Unified Process encourages use-case driven development.
Use case levels n User-goal level n n Subfunction level n 42 A complete process from the view point of a user to meet a goal of the user, roughly corresponding to an elementary business process. Details steps to support a user goal.
Use-case driven development n n 43 Requirements are primarily recorded in the Use Case model. Iterations are planned around implementing particular Use Cases. Use Case Realizations drive design. Use Case often influence the way user manuals are organized.
Use Cases are always wrong! n n n 44 Written documentation gives the illusion of authority and correctness, but it is an illusion. Use cases give a preliminary understanding that users and developers can discuss and agree on. But there should be constant feedback from customers in the development process to correct missing information and misinformation before it jeopardizes the functionality of the program.
Bibliography n n 45 http: //members. aol. com/acockburn/papers /Alt. Intro. htm http: //www. usecases. org/
Мы удаляем страницу по первому запросу с достаточным набором данных, указывающих на ваше авторство. Мы также можем оставить страницу, явно указав ваше авторство (страницы полезны всем пользователям рунета и не несут цели нарушения авторских прав). Если такой вариант возможен, пожалуйста, укажите об этом.