Writing Use Cases
This is perhaps the most difficult part of understanding Use Cases. What constitutes a "good" Use case?
- Describes what the system DOES
- Does not describe what the system "must" do, "should" do or "could" do.
- Does not describe HOW the system achieves it's goals
- Describing HOW is part of design and scenarios are better suited for describing how things work
- Does NOT describe the User Interface
- Describes the logical interaction vs physical interaction
- Eg: "User clicks the 'change password' link" - physical
- "User indicates that he/she wishes to change his/her password" - logical
- Identify the goals of each actor
- What do the actors require from the system?
- The actor arrives, interacts with the system, then leaves.
- Review requirements
- Identify tasks which the system must perform
- Analyze the roles people fulfill within the business and the tasks they perform
Use Case Modeling Errors
- Write functional requirements instead of usage scenario text.
- We need to keep a clear distinction between (active voice) usage descriptions (behavior) and (passive voice) system requirements.
- Describe attributes and methods rather than usage.
- Methods shouldn’t be named or described in case text because they represent how the system will do things, as opposed to what the system will do.
- Write the use cases too tersely.
- Divorce yourself completely from the user interface.
- Write using a perspective other than the user’s, in passive voice.
- Describe only user interactions; ignore system responses.
- Your use case text describes both sides of the dialog between the user and the system, and that all of the software behavior that you’re trying to discover happens on the system side of that dialog.
- Omit text for alternative courses of action.
- Focus on something other than what’s “inside” a use case, such as how you get there or what happens afterward.
- Include information which is redundant to the rest of the system documentation.
- Do not include information about other use cases.
Basic Course: The Customer enters the required information. The system validates the information and creates a new Account object.
Alternate Course: If any data is invalid, the system displays an appropriate error message.
The Customer enters his or her user ID and password, and then clicks the Log In button. The system returns the Customer to the Home Page.
On the Shopping Cart Page, the Customer modifies the quantity of an Item in the
Shopping Cart, and then presses the Update button. Then the Customer presses the
Continue Shopping button.
Basic Course: If the Customer modifies the quantity of an Item in the Shopping
Cart, and then presses the Update button, the system will store the new quantity,
and then compute and display the new cost for that Item….
Alternate Course: The system will delete an Item from the Shopping Cart if the
quantity of that Item in that Shopping Cart becomes 0.
The Receiving Clerk ensures that the Line Items listed on the Purchase Order match
the physical items. The Clerk waves the bar code on the packing slip under the
sensor at the receiving station. The system executes a “change order status” method
to change the Order status to “fulfilled,”and then calls the changeQuantityOnHand
method for each of the variousBooks. The Clerk hands the Books off to the Inventory