What is a use-case? How to identify a use-case? [c

2020-07-22 16:34发布

问题:

The question is quite generic. What are the points that should be kept in mind to identify a valid use case? How to approach a use case?

回答1:

A use case identifies, with specificity, a task or goal that users will be able to accomplish using a program. It should be written in terms that users can understand.

Wikipedia's description is overly formal. I'll dig through my other texts shortly. In contrast, the original wiki's article is much more accessible.

An early article by Alastair Cockburn, cited positively by The Pragmatic Programmer, contains a good template.

This question, from just a few days ago, is very closely related, but slightly more specific.



回答2:

The definition of use case is simple:

An actor's interactions with a system to create something of business value.

More formally:

a sequence of transactions performed by a system that yield a measurable set of values for a particular actor.

They're intended to be very simple: Actor, Interaction, Value. You can add some details, but not too many.

Using use cases is easy. Read this: http://www.gatherspace.com/static/use_case_example.html

The biggest mistake is overlooking the interaction between actor and system. A use case is not a place to write down long, detailed, technical algorithm designs. A use case is where an actor does something.

People interact with systems so they can take actions (place orders, approve billing, reject an insurance claim, etc.) To take an action, they first make a decision. To make a decision, they need information

  • Information
  • Decision
  • Action

These are the ingredients in the "Interaction" portion of a use case.



回答3:

A valid use case could describe:

  • intended audience / user
  • pre-requisites (ie must have logged in, etc)
  • expected outcome(s)
  • possible points of failure
  • workflow of user


回答4:

From Guideline: Identify and Outline Actors and Use Cases by the Eclipse people:

Identifying actors

Find the external entities with which the system under development must interact. Candidates include groups of users who will require help from the system to perform their tasks and run the system's primary or secondary functions, as well as external hardware, software, and other systems.

Define each candidate actor by naming it and writing a brief description. Includes the actor's area of responsibility and the goals that the actor will attempt to accomplish when using the system. Eliminate actor candidates who do not have any goals.

These questions are useful in identifying actors:

  • Who will supply, use, or remove information from the system?
  • Who will use the system?
  • Who is interested in a certain feature or service provided by the system?
  • Who will support and maintain the system?
  • What are the system's external resources?
  • What other systems will need to interact with the system under development?

Review the list of stakeholders that you captured in the Vision statement. Not all stakeholders will be actors (meaning, they will not all interact directly with the system under development), but this list of stakeholders is useful for identifying candidates for actors.

Identifying use cases

The best way to find use cases is to consider what each actor requires of the system. For each actor, human or not, ask:

  • What are the goals that the actor will attempt to accomplish with the system?
  • What are the primary tasks that the actor wants the system to perform?
  • Will the actor create, store, change, remove, or read data in the system?
  • Will the actor need to inform the system about sudden external changes?
  • Does the actor need to be informed about certain occurrences, such as unavailability of a network resource, in the system?
  • Will the actor perform a system startup or shutdown?

Understanding how the target organization works and how this information system might be incorporated into existing operations gives an idea of system's surroundings. That information can reveal other use case candidates.

Give a unique name and brief description that clearly describes the goals for each use case. If the candidate use case does not have goals, ask yourself why it exists, and then either identify a goal or eliminate the use case.

Outlining Use Cases

Without going into details, write a first draft of the flow of events of the use cases identified as being of high priority. Initially, write a simple step-by-step description of the basic flow of the use case. The step-by-step description is a simple ordered list of interactions between the actor and the system. For example, the description of the basic flow of the Withdraw Cash use case of an automated teller machine (ATM) would be something like this:

  1. The customer inserts a bank card.
  2. The system validates the card and prompts the person to enter a personal identification number (PIN).
  3. The customer enters a PIN.
  4. The system validates the PIN and prompts the customer to select an action.
  5. The customer selects Withdraw Cash.
  6. The system prompts the customer to choose which account.
  7. The customer selects the checking account.
  8. The system prompts for an amount.
  9. The customer enters the amount to withdraw.
  10. The system validates the amount (assuming sufficient funds), and then issues cash and receipt.
  11. The customer takes the cash and receipt, and then retrieves the bank card.
  12. The use case ends.

As you create this step-by-step description of the basic flow of events, you can discover alternative and exceptional flows. For example, what happens if the customer enters an invalid PIN? Record the name and a brief description of each alternate flow that you identified.

Representing relationships between actors and use cases

The relationship between actors and use cases can be captured, or documented. There are several ways to do this. If you are using a use-case model on the project, you can create use-case diagrams to show how actors and use cases relate to each other. Refer to Guideline: Use-Case Model for more information.

If you are not using a use-case model for the project, make sure that each use case identifies the associated primary and secondary actors.