Chapter 19. Developing the Use Cases

What You'll Learn in This Hour:

  • The care and feeding of use cases

  • Specifying descriptions, preconditions, and postconditions

  • Specifying steps

  • Diagramming the use cases

The use cases from the package diagram in Hour 18, “Gathering System Requirements,” give a good picture of what the system will have to do. The team will have to analyze and understand each one. They've moved gradually from understanding the domain to understanding the system. The use cases have provided the bridge.

If you're getting the idea that the system development project is use case driven, you have a good understanding of the whole process.

Notice that at no point in the JAD session did the development team discuss how the system would accomplish all the activities specified in the panoply of use cases. The idea was just to enumerate all the possible use cases. As the use cases are fleshed out in this hour, notice how the components of the WIN system start to materialize. At this point in the development effort, the system begins to take center stage.

Now, put yourself in the shoes of the development team, and we'll deal with part of this collection of use cases.

The Care and Feeding of Use Cases

To analyze the use cases, you have to run another JAD session. The discussion in this JAD session is intended to derive an analysis for each use case.

A word of caution: The use case JAD session is usually the most difficult one, as it calls for the participants—potential users of the finished system—to become analysts. In their own niche, each one is a domain expert, and you have to tap into their expertise. Typically, they're not used to either verbalizing or analyzing what they know. They probably haven't been part of a system design effort before, and they may be uncomfortable trying to specify what a system should do to help them carry out their work.

In order to alleviate the strain, it's best to organize the JAD session so that the team deals with one group at a time—for instance, just the servers. That way, the others won't sit idly by as the servers analyze their use cases. The overall domain experts, the restaurateurs, can show up to lend a hand with all the groups. A cross-section of the users would be appropriate when dealing with the Customer package.

The use cases are numerous. Just to keep this hour manageable, we'll focus on the first eight use cases for the Server package. After you see how these analyses are done, you'll be able to deal with the remaining Server use cases, as well as the use cases for the other packages, on your own. (See the exercises in the Workshop at the end of this hour.)

The Use Case Analysis

Remember (from Hour 7, “Working with Use Case Diagrams”): Each use case is a collection of scenarios, and each scenario is a sequence of steps. For each scenario in each use case, you'll want to show

  • A brief description of the scenario

  • Assumptions for the scenario

  • The actor who initiates the use case

  • Preconditions for the use case

  • System-related steps in the scenario

  • Postconditions when the scenario is complete

  • The actor who benefits from the use case

(In your analysis, you can also include any exception conditions or alternative flows. I've kept the scenarios simple for this example, however.)

No specific way of laying out a use case analysis is correct. The items listed typically provide a complete picture of a use case.

In your design document (the document you give your client and the programmers), each of these use case analyses will have a separate page. You'll probably want to include a diagram of the use case, complete with actors, on this page.

The system-related steps in the scenario are extremely important. They'll show how the system is supposed to work. When the JAD session participants tell you these steps, they're describing, in effect, what the system will ultimately look like. After this JAD session, you should have a good idea about the components of the system.

The assumptions are important, too. In the list of assumptions, you can list design considerations, as you'll see.

This is what I meant by the system development project being use case driven. The use cases will ultimately create the path to the system.

The Server Package

The Server class seems to figure in the greatest amount of activity. This isn't surprising because the Server interacts with virtually every other class.

The Server use cases are

  • Take an order

  • Transmit the order to the kitchen

  • Change an order

  • Track order status

  • Notify chef about party status

  • Total up a check

  • Print a check

  • Summon an assistant

  • Summon a busser

  • Take a drink order

  • Transmit a drink order to lounge

  • Receive acknowledgment

  • Receive notification from lounge

  • Receive notification from kitchen

Take an Order

Let's begin with “Take an order.” The team relies on experienced servers for a description, assumptions, preconditions, steps, and postconditions. The package and subpackage already indicate the initiating actor (Server) and the benefiting actor (Customer).

A good one-sentence description might be, “The server enters the customer's order into the handheld device and transmits it to the kitchen.” The assumptions are that a customer wants a meal, the customer has read the menu, and the customer has made a selection. Another assumption is that the server's handheld has a user interface dedicated to order entry.

The preconditions are that the customer has been seated and has read the menu. The postcondition is that the order is entered into WIN.

The steps in the use case are

  1. On the handheld computer, the server activates the user interface for order entry.

  2. The order-entry user interface appears.

  3. The server enters the customer's menu selection into WIN.

  4. The system transmits the order to the kitchen PC.

Although the assumption is that an order entry interface exists, you haven't yet specified how that interface will look or how the physical act of entering the order will proceed. You don't know yet what the kitchen PC's user interface will look like, nor have you said anything about the technical details of transmitting an order.

The point is that as you state your design assumptions, you're starting to get a handle on what the system is supposed to do, and you'll start to crystallize your thoughts on how to do it. The steps in the use cases force you to come up with assumptions about the components of the system. Remember that the use cases are intended to show how the system looks to a user.

Transmit the Order to the Kitchen

Ready for another? This one will be included in (that is, used by) at least two use cases—the previous one and “Change an order.”

The description is, “Take an order entered into the handheld, put it on the wireless network, and send it to the kitchen PC.” The assumptions are that you'll have a means of communicating the order (via a wireless network), and again, that you have an order-entry interface. Do you have to repeat this assumption? You do. Each use case will eventually appear on a separate page in the design document, which will serve as a reference about the system. For clarity, the assumptions should appear on each use case, even if you have to repeat them from use case to use case.

The precondition is an order entered into a handheld. The postcondition is that the order has arrived in the kitchen. The benefiting actor is the customer.

The steps are

  1. A button-click in the order-user interface indicates “Send to kitchen.”

  2. WIN transmits the order over the wireless LAN.

  3. The order arrives in the kitchen.

  4. The order-entry user interface on the handheld indicates that the order arrived in the kitchen.

Obviously, you have to change your use case diagram for the customer subpackage. It has to show the «include» dependency between this use case and “Take an order” and between this use case and “Change an order.” Figure 19.1 shows the updated use case diagrams for the Server package.

The updated use case diagrams for the Server package.

Figure 19.1. The updated use case diagrams for the Server package.

Change an Order

While we're on the subject, let's move to “Change an order.” The description is, “Modify an order already entered into WIN.” The assumption is that an order has already been placed and sent to the kitchen and that, subsequently, the customer wants to change that order. You also assume that WIN has a database of orders showing the server who entered each order and the table the order came from, that the server can access the database from the handheld, that WIN can make transmissions from the handheld to the kitchen PC and back, and that the handheld has a user interface screen for changing an order.

The precondition is the previously placed order. The postcondition is that the modified order has arrived in the kitchen. The benefiting actor is the customer.

The steps in this use case are

  1. On the handheld computer, the server activates the user interface screen for changing an order.

  2. The user interface brings up a list of existing orders in the kitchen placed by this server.

  3. The server selects the order to be changed.

  4. The server enters the modification to the order.

  5. The system transmits the order to the kitchen PC.

    (Step 5 includes the previous use case “Transmit the order to the kitchen.”)

Track Order Status

As you might recall, earliest discussions about the restaurant of the future included finding out when a customer's order will come out of the kitchen. This use case does just that. Implementing it in the system will go a long way toward facilitating the server's job.

The description is, “Track the status (time to completion) of an order already entered into WIN.” The assumption is that an order has already been placed, has been sent to the kitchen, and that the customer wants to know how much longer it will take for the food to arrive. You repeat two of the previous design assumptions: a database of orders and the capability to transmit messages back and forth between the handheld and the kitchen PC. You also assume a user-interface screen on the handheld for tracking orders and a user-interface screen on the kitchen PC for the same purpose.

The precondition is the previously placed order. The postcondition is that the order status has arrived at the server's handheld. The benefiting actor is the customer.

The steps are

  1. On the handheld computer, the server activates the user-interface screen for tracking an order entry.

  2. The user interface brings up a list of existing orders in the kitchen that this server has placed.

  3. The server selects the order to be tracked.

  4. The system transmits a tracking message to the kitchen PC.

  5. The kitchen PC receives the message.

  6. The chef brings up the tracking order interface on the kitchen PC.

  7. The chef enters a time estimate for the order's completion.

  8. The system transmits the time estimate back to the server's handheld.

Notify Chef About Party Status

Starting with this use case, I'll use subheadings within these subsections to indicate the aspects of the use case analysis, and I'll use bullets to set off phrases within those subheadings—with two exceptions: I'll still number the steps, and I won't use bullets for the description.

Description

Via the network, the server tells the chef that a customer is almost finished with the appetizer.

Assumptions

  • The server is in the customer's serving area.

  • The server can gauge the customer's progress.

  • The system has a user-interface screen for customer status.

  • The system transmits messages from handheld to kitchen PC and vice versa.

Preconditions

  • The customer is partially finished with the appetizer.

Postconditions

  • The chef has initiated the final stages of completing the main course.

Steps

  1. On the handheld computer, the server activates the interface screen for customer status.

  2. The user interface brings up a list of the tables in the server's serving area.

  3. The server selects the table of interest.

  4. The server sends an “almost finished with appetizer” message about this table to the kitchen PC.

  5. The kitchen PC receives the message.

  6. The server receives an acknowledgment from the kitchen PC.

This last step uses the “Receive acknowledgment” use case, which is in the Server package. Figure 19.2 shows a diagram for the “Notify chef about party status” use case. (In somewhat traditional style, Figure 19.2 shows the benefiting actor. Many modelers now don't bother to show this actor in a use case diagram.)

The use case diagram for “Notify chef about party status.”

Figure 19.2. The use case diagram for “Notify chef about party status.”

Benefiting Actor

  • Customer

Total Up a Check

Here's an important use case. Without it, a restaurant wouldn't make any money!

Description

Add up the items in the order.

Assumptions

  • There is a database of orders accessible to the server's handheld.

  • Each item in the order is attached to its price.

Preconditions

  • The party has completed its meal.

Postconditions

  • The bill is totaled.

Steps

  1. The server brings up a list of active orders on the handheld.

  2. The server selects the appropriate order.

  3. The server clicks a button on the handheld to total the check.

  4. The system calculates the total from the prices in the order.

Benefiting Actor

  • Customer

Print a Check

Although this one may seem trivial, it's an important part of the transaction.

Description

Print the totaled check.

Assumptions

  • A (wireless) networked printer is located in the serving area.

Preconditions

  • A totaled check

Postconditions

  • A printed check

Steps

  1. The server clicks a button on the handheld to print the check.

  2. The networked printer in the serving area prints the check.

  3. The server clicks a button on the handheld to remove this order from the list of active orders.

Benefiting Actor

  • Customer

Summon an Assistant

This one is important because assistants help keep everything flowing smoothly.

Description

Request an assistant to clean the table for the next customer.

Assumptions

  • The system allows wireless communication between two mobile employees.

  • The system has a user interface screen for sending a message to an assistant.

Preconditions

  • An empty table that must be cleaned and reset

Postconditions

  • The assistant has come to the table to clean and reset it.

Steps

  1. The server activates the interface for sending a message to an assistant.

  2. The server receives an acknowledgment from the assistant.

As in the “Notify chef about party status” use case, the last step uses the “Receive acknowledgment” use case.

Benefiting Actor

  • Assistant

Analyzing this use case as well as the use cases in the Assistant package, might lead you to believe that splitting the Assistant class into two classes, AssistantServer and AssistantChef, is a good idea. (It just makes things cleaner.) Could they be children of an abstract Assistant class? They could, but you probably wouldn't gain much from setting up this abstract class.

Creating these two new classes necessitates revisiting the domain analysis. You have to rework the class diagrams, particularly the diagram for Employee, as Figure 19.3 shows.

The updated class diagram for Employee.

Figure 19.3. The updated class diagram for Employee.

You would also have to update your package diagrams to include an Assistant Server package and an Assistant Chef package.

This is an example of how the segments of GRAPPLE feed each other. The knowledge gained during use case analysis has helped you evolve the domain analysis.

Remaining Use Cases

The remaining use cases in the Server package are roughly analogous to the ones you just analyzed. I leave it to you as an exercise to finish the analyses for this package. (See Exercise 2 in the “Workshop.”)

Components of the System

One important aspect of the use case analysis is that you begin to reveal the components of the system. Before you leave this hour, take note of the components that have emerged through your analysis of the use cases in the Server package. You'll find them in the “Assumptions” section of each use case analysis. (Additional components will become apparent when you do the exercises.)

On the software side, it's obvious that a number of user interface screens are necessary. WIN will need handheld-based user interfaces for order entry, order change, order status tracking, customer status, and sending messages to an assistant. For good measure, something like an interface “home page” will be necessary to keep all these other interface screens organized. WIN will also need a user interface on the kitchen PC to enable the chef to see and track each order. In general, any of these user interfaces should display that home page, accept user input, and display messages. If the restaurant wants to really delight its customers, all the user interfaces should be capable of tracking an order and tracking a customer's status. That way, anyone who has access to WIN will be able to answer a customer's questions and be sensitive to that customer's status.

It also seems that you'll need a database to contain all the orders. Each record will contain the table number, the order, the time the order went in, the server, whether the order is active, and more.

Of course, you'll also need an order processor that works behind the interfaces to create orders, send them where they're supposed to go, and register them in the database.

Figure 19.4 shows a class diagram that models the interfaces, the database, and the order processor. It also shows some of their operations. This will come in handy in the next hour when you examine the interactions among these components.

Modeling the components of WIN.

Figure 19.4. Modeling the components of WIN.

On the hardware side, you'll need a wireless network, handheld computers for the mobile employees (servers, assistant servers, and bussers), and a desktop PC in the kitchen and another in the lounge. You'll need a networked printer in each serving area. You'll probably need a palmtop and a printer for the coat-check clerk, too.

The order processor and the database of orders have to reside on a computer. One possibility is to have a central machine that holds the order processor and the database and makes them accessible to all other machines on the network. The wireless network, then, would allow wireless communication among the handheld computers and desktop PCs and this central computer.

A rather involved design document is starting to take shape. In the next hour, you'll delve even further into the use cases.

Summary

It's not enough to list all the use cases. A development team has to understand each one in great detail in order to begin to understand the system. In this hour, accordingly, you went through the intricacies of use case analysis.

A use case analysis involves specifying a description of the use case, deriving the preconditions and postconditions, and specifying the steps. One important aspect of the use case analysis is that the components of the system begin to emerge.

Q&A

Q1:

In the initial segment of GRAPPLE, I notice you skipped over the action “Identify cooperating systems.” Why is that?

A1:

As you'll remember, this development team started with a blank piece of paper. No cooperating systems existed. The next system that someone devises for LNG Restaurants, however, might have to access WIN in some way.

Q2:

In this hour, you modified the use case diagrams and the class diagram. Does this usually happen?

A2:

Yes. You can never be hesitant about making changes as your knowledge evolves. The original list of use cases captured all the knowledge at one point in the effort, and it represents a snapshot at that point. The modified diagrams represent the development team's latest thinking.

Workshop

The workshop for this hour tests your knowledge on fleshing out use cases. To see the fleshed-out answers, turn to Appendix A, “Quiz Answers.”

Quiz

1:

What are the parts of a typical use case diagram?

2:

What does it mean for a use case to include (or use) another use case?

Exercises

1:

Draw the use case diagram for “Summon an assistant.”

2:

Analyze the remaining use cases in the Server package, and draw use case diagrams.

3:

Analyze the use cases in the Chef package, and draw use case diagrams.

4:

Do the same for the Bartender, Assistant, and Busser packages.

5:

Examine Figure 19.4. What additional interface classes should the model include? What would their operations be?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.17.20