Introduction
Conceptually, requirements are requested system’s features, often described as properties that help a system fulfill its purpose. Requirements are the product of the requirements elicitation process, a central part of requirements engineering (cf. Requirements Engineering: Principles and Practice, p. 949) intended to determine the needs of the system stakeholders. In that context, functional requirements capture the intended behavior of the system in question. This behavior may be expressed as services, tasks, or functions a system is required to perform. Here, one of the most important goals of requirements engineering is to help system stakeholders understand the behavior of the system in question. Among the different techniques for capturing system behavior, use cases are of major importance because their approach ensures expressing requirements in a way understandable to both users and developers.
This entry discusses use cases as a requirements engineering approach to capturing functional requirements. The entry elaborates use case concepts, best practices, and traps to avoid. The following subsection gives an overview of use cases and their implication in software development. The Use Case Concepts section emphasizes the use case concepts in terms of actors, use case description, scenarios, pre- and postconditions, diagrams, and best practices. The ATM Use Case Model: A Case Study section presents a case study example and finally the Summary concludes the entry.
Understanding Use Cases
Functional requirements capture the intended behavior of the system. This behavior may be expressed as services, tasks, or functions the system is required to perform (IEEE Std 1998 ). Use cases have been recognized as a valuable approach to discovering and presenting functional requirements. Craig Larman calls use cases “stories of using the system,” providing an excellent technique to both understanding and describing requirements (Larman 2004). The advantage is that system users may see just what a new system is going to do. This is possible because a use case is expressed with a flow of events presenting scenarios of system use understandable to both users and developers. Moreover, the use case approach is considered as a practical technique for documenting requirements where use cases emphasize system users’ goals and demonstrate how the system works with users to achieve these goals ( Bittner et al. 2003 ; Larman 2004). In that context, a use case can be defined as a software engineering technique that defines a goal-oriented set of interactions between system users called actors and the system under consideration.
Example: A user (actor) logs on to (goal) the automated teller machine (ATM) (system) using an ATM card and entering personal identification number (user–system interactions).
In general, use cases are text documents. However, the UML ( Booch et al. 2005 ) provides a special use case diagram notation to illustrate the use case model of a system. Hence, a use case model consists of use case diagrams depicted in UML and use case description providing detailed information about the requirements. Here, the description is considered as the most important part because it documents the flow of events between the actors and the system in question. Use case diagrams provide a sort of road map of relationships between the use cases in a model and help system stakeholders better understand the user–system interaction process. It is important to mention though that a use case model does not impose the structure of the system in question; that is, use cases do not represent objects or classes of the resultant system design.
Use-Case-Driven Development Process
Use cases were first proposed by Jacobson in 1987 and have since become one of the key techniques for modeling requirements. Nowadays, use cases impose use-case-driven development as a vital part of the so-called unified process (UP) ( Jacobson et al. 1999 ). The latter has emerged as a popular software development process targeting object-oriented systems. The following elements present some of the impacts the use cases have on the software development process:
- Because use cases impose an efficient approach to recording software requirements, they have become the primary (preferred by software development teams) requirements technique. Although popular in the past, other techniques such as functions list have become secondary.
- Use cases emphasize activities from three stakeholder perspectives—problem, solution, and project ( Spence and Bittner 2004 ).
- Use cases promote the so-called iterative planning in the rational UP ( Royce 1998 ; Spence and Bittner 2004 ), which is a framework for iterative software development. In this approach, the software development process is divided into iterations to gain better control over the system development and to mitigate risk ( Larman 2004 ; Spence and Bittner 2004 ).
- Use cases are not object oriented; that is, the use case approach does not require object-oriented analysis. Hence, use cases may be applied to nonobject-oriented projects employing procedural languages, such as C, or functional languages, such as Scheme or Lisp. This increases the applicability of use cases as a software requirements technique (Larman 2004).
- Use case realizations drive the software design.
- Conceptually, use cases describe features of the system, and although the use case approach is not object oriented, it helps developers determine the design classes.
- Use cases may be used by developers to derive test cases and test case scenarios. In fact, use cases and test cases may be much coupled, thus forcing the development team to think about testing from the very beginning. In such a case, requirements engineering and test development are synchronized processes.
- Clear and effective use cases promote better communication between the system’s stakeholders; for example, the use cases present the system’s features in a format understandable to all the stakeholders. In addition, the so-called business use cases (Larman 2004) help developers understand and business managers express potential business situations that the system may face. This helps to understand the context of a new system in the business environment.
To summarize, by targeting the system behavior the use cases focus on capturing the functions of a system, thus eventually driving the process of software development and providing traceability from requirements to design via test cases. Therefore, creating a robust, effective, and comprehensive set of use cases covering all functional requirements might be the most important task in requirements engineering.
Use Case Concepts
The general objective of use cases is to capture all functional requirements of a software system. Conceptually, a use case represents an activity that actors (e.g., users) may perform with a system. Such an activity is presented via possible scenarios identifying different flows of events driving the activity into different paths. A use case typically includes name and description, captured functional requirements, constraints, activity scenarios, use case diagrams, scenario diagrams, and additional information. A use case model of a particular system is a set of related use cases and actors.
Use Case Actors
The concept of actor is central to use case modeling. An actor represents a class of system users playing a specific role in use cases. Note that several users may play the same role in a system and an actor represents a single role, not a single user. Here, all the actors in a use case model from a list of all possible roles one may play when interacting with the system. Moreover, a single user may take one or more roles. Both actors and use cases determine the scope of the system in question. Actors are external to the system and use cases happen within the system.
The roles presented by actors may be taken not only by humans but also by organizations, machines, or machine components, and other software systems or software components. Note that actors may have a collaborative or participatory role in a use case. Here, actors may have goals in the system in question and participate in use cases to fulfill those goals, or they may provide support to the system. From this perspective, we distinguish three kinds of actors:
- Primary actors have goals that can be met by using the services (or functions) of the system. Note that identifying all the primary actors is of major importance because by knowing these actors we may identify their goals driving the use cases.
- Example: A client (primary actor) deposits money (goal) in the bank (system).
- Supporting actors provide supporting services to the system. Such an actor is often a computerized system or machine, but it can also be another system, organization, or person. It is important to identify the supporting actors because they help the design team discover external interfaces and protocols needed by the system in question.
- Example: Any money transfer operation requires data exchange with the ATM server (supporting actor).
- Offstage actors are not directly involved in any use cases but have an interest in some aspects of the system behavior, that is, in some of the use cases. Although not of major importance, the identification of these actors helps requirements engineering ensure that all stakeholder interests are identified and satisfied. Often, offstage actors are not presented in the use case model unless they are explicitly named by other system stakeholders.
- Example: When pressed, the emergency button turns on the hidden camera and calls the police department (offstage actor).
Use Cases
In the use case model approach, primary actors use the system via use cases. Here, the latter describe what the system does for the primary actors, what services the system requires from the supporting actors, and eventually what the offstage actors’ interest in the system is. Use cases can be written in different formats. There are three possible degrees of detail in use case description (Larman 2004):
- Brief : the use case in question is summarized in one paragraph by emphasizing only the basic scenario (cf. the Basic Scenario section).
-
Casual : informal text usually expressed in multiple paragraphs that cover various use case scenarios (cf. the Use Case Scenarios section).
- – Fully dressed : all steps of all the possible scenarios are explained in detail; supporting sections are used to add more information, such as actors, related use cases, preconditions, postconditions, and failure conditions (cf. Table E.1 ).
Table E.1 Fully Dressed Use Case Description Example | Name | Get Demand | | --- | --- | | Actor | Worker | | Description | A worker seeks and gets any pending demand from the demand space (DS). | | Related use cases | This use case is included in the use case “Dispatch demand,” and it includes the use case “Migrate demand.” | | Preconditions | A pending demand is stored in the DS. | | Basic scenario |
- The worker completes its work and makes its associated transport agent (TA) listen to the DS for any pending demand.
- The TA discovers a pending demand through its associated dispatcher proxy (DP).
- The DP changes the status of that demand from pending to in process.
- The DP takes a copy of that demand and passes it to the TA.
- The TA migrates the demand copy to the worker (refers to the use case Migrate demand).
| | Alternative | 1.1. The dispatch demand (DD) is local to the worker, and the worker makes its associated DP listen to the DS for any pending demand.
- 1.1.1. The DP discovers a pending demand.
- 1.1.2. The DP changes the flag of the demand from pending to in process.
- 1.1.3. The DP takes a copy of that demand and passes it to the worker.
| | Failure | 1.1. The worker cannot find its associated TA. | | Failure conditions | The TA is no longer available due to a network failure or due to a TA failure. | | Postconditions |
- The copy of the demand is delivered to the worker.
- The state of the original demand is changed to “in process.”
|
There is no single-format template for writing use cases. Table E.1 shows an example of a fully dressed use case description borrowed from Vassev ( 2009 ). As shown, the use case description is structured in a tabular format and presents detailed information helping the readers understand actors’ goals, tasks, and requirements. Note that use cases may be related through special relationships. As described, the Get Demand use case is included in a use case and itself includes another one (cf. Related Use Cases in Table E.1 ). The relationships among the use cases in a single use case model may be graphically presented by a special use case diagram (cf. the Black-Box and White-Box Use Cases section).
Use Case Scenarios
Conceptually, a single use case may result in multiple possible scenarios each forming a single use case instance; that is, one path through the use case (Larman 2004). Often a use case defines a collection of possible scenarios each presenting a distinct flow of events that may occur during the performance of a use case by an actor. Thus, a use case scenario is a sequence of actions and interactions between actors and the system in question. A use case scenario is usually described in text and depicted visually with a sequence diagram (cf. the Alternative Scenario section). The description of a use case may encompass three different types of scenarios (paths)—basic scenario, alternative scenario, and failure scenario. Here, a use case may be defined as a collection of related scenarios that describe how actors use a system to achieve a goal.
To fully comprehend the diversity of use case scenarios, it is important to remember that a use case scenario is a single path through a use case. In that context, Figure E.1 depicts a generic view of the possible paths through a use case. As shown, the straight arrow represents the basic scenario, and the curves represent the alternative paths some of which could result in failure scenarios. Here, some paths return to the basic scenario, and some end the use case.
Figure E.1 Use case scenarios—paths through a use case.
Basic Scenario
A basic scenario (also called a basic flow of events [ Bittner et al. 2003 ]) describes the main sequence of actions and interactions where a use case is completed correctly and is straightforward. Note that every use case comprises one sole basic scenario that shows the most realistic path of succeeding the use case objective. In such a scenario, no interruption in the basic course of action occurs nor are alternative paths taken (cf. the basic scenario in Tables E.1 and E.2). Due to these Description characteristics, Cockburn ( 2001 ) and Larman ( 2004 ) refer to the basic scenario as the main success scenario.
Alternative Scenario
Besides the basic scenario, a use case may have one or more alternative (optional) scenarios (cf. alternative scenarios in Table E.2 ). Larman ( 2004 ) calls the alternative scenarios’ use case extensions and describes them as branches from the main success scenario. According to Cockburn ( 2001 ), an alternative scenario is an alternative course that has an individual goal that leads to success and a minimal guarantee. Here, if the basic scenario represents the main route to successful use case goal accomplishment, the alternative scenarios may be considered as detours ( Bittner et al. 2003 ). Thus, the alternative scenarios complement the basic one. Although some may be essential to the success of the system, often the alternative scenarios are extraneous. To define such scenarios, we may simply define where those branch from the basic scenario, the alternative sequence of steps, and where the original scenario is resumed. Sometimes, the alternative scenarios may explicitly end the use case without returning to their original scenario (e.g., the basic scenario). It is also possible to have alternative scenarios branching from other alternative scenarios (cf. Figure E.1 ). In such a case, the original scenario is no longer the basic scenario but the first alternative scenario.
Table E.2 Use Case “Place Order” | Name | Place Order | | --- | --- | | Actor | Customer | | Description | The customer provides address information and a list of product codes. The system confirms the order. | | Preconditions | The customer must be logged on to the system. | | Basic scenario |
- Customer enters name and address.
- Customer enters product code for items they wish to order.
- The system supplies a product description and price for each item.
- The system keeps running the total of ordered items as they are entered.
- The customer enters credit card information.
- The system validates the credit card information.
- The system issues a receipt to the customer.
| | Alternative #1 | 3.1. The product is out of stock:
- 3.1.1. The system informs the customer that the product cannot be ordered.
- 3.1.2. Continue with 2.
| | Alternative #2 | 6.1. The system rejects the credit card.
- 6.1.1. The system informs the customer that the credit card information is not valid.
- 6.1.2. Continue with 5.
| | Alternative #3 | Alternative #1 and Alternative #2 | | Failure | 6.1.2.1. The customer cancels the order. | | Failure Conditions | The credit card is not valid. | | Postconditions | An order has been submitted. |
Failure Scenario
Some of the alternative scenarios may be viewed as failure (or exceptional) scenarios. Such scenarios describe errors that can occur and the way those should be handled by the system ( Bittner et al. 2003 ). Failure scenarios handle paths through a use case that lead to the failure of the overall use case goal. Such paths never return to the path of the basic scenario or another alternative success scenario. Thus, failure scenarios always explicitly end the use case. Some authors termed failure scenario as use case exception ( Kulak and Guiney 2003 ; Metz et al. 2003 ; Simons 1999 ). Here, the interaction path of a use case exception can be viewed as the recovery statements of a handled programming language exception.
Scenario Description Example
Table E.2 presents another use case description example. Here, the so-called Place Order use case comprises, in addition to the sole basic scenario, three alternative and one failure scenarios.
Because neither Alternative #1 nor Alternative #2 scenario ends the use case (both join the basic scenario), and because these two scenarios are not mutually exclusive, their combination results in Alternative #3 scenario. Note that both alternative and failure scenarios are not presented with their full list of steps, but only with steps that branch from the basic scenario (e.g., Alternative #1 to #3 scenarios) or from another alternative/failure scenario (e.g., failure scenario). Moreover, as described, all the alternative scenarios follow paths that join the basic scenario at a particular step. For example, Alternative #1 scenario joins the basic scenario at step 3.1.2 (cf. Table E.2 ). Figure E.2 depicts the paths through the Place Order use case as described in Table E.2 . Following these paths, we can easily determine all the possible scenarios and eventually discover new ones. Note that only the paths covering the basic scenario and the failure scenario end the use case.
Here, the sequence of steps for the different scenarios are as follows:
- Basic: 1, 2, 3, 4, 5, 6, and 7.
- Alternative #1: 1, 2, 3.1, 3.1.1, 3.1.2, 2, 3, 4, 5, 6, and 7.
- Alternative #2: 1, 2, 3, 4, 5, 6.1, 6.1.1, 6.1.2, 5, 6, and 7.
- Alternative #3: 1, 2, 3.1, 3.1.1, 3.1.2, 2, 3, 4, 5, 6.1, 6.1.1, 6.1.2, 5, 6, and 7.
- Failure: 1, 2, 3, 4, 5, 6.1, 6.1.1, and 6.1.2.1.
Note that more scenarios are possible when the use case iterates multiple times over the alternative paths. For example, two iterations over Alternative #1 path will result in the following sequence.
- 1, 2, 3.1, 3.1.1, 3.1.2, 2, 3.1, 3.1.1, 3.1.2, 2, 3, 4, 5, 6, 7
Use case scenarios may be presented graphically in the UML sequence diagrams (cf. the System and Business Use Cases section).
Use Case Preconditions and Postconditions
A use case may be defined with the required states of the actors and the system itself at the time a use case is to be started. This specific definition is known as use case preconditions. Thus, with the preconditions, we define conditions that must be met in order to perform a use case. Note that the preconditions are not a description of the events that start the use case in question, but a description of the specific conditions under which the use case is applicable ( Bittner et al. 2003 ). For example, the Get Demand use case (cf. Table E.1 ) can be performed only if a pending demand is stored in the DS, or the customer must be logged on to the system in order to perform the Place Order use case (cf. Table E.2 ). Here, the preconditions are necessary conditions but not sufficient to perform a use case; that is, only an actor may perform a use case.
Figure E.2 Paths through the Place Order use case.
In addition to the preconditions, a use case may also be defined with the so-called postconditions used to define the required states of the system at the end of a use case. There could be different postconditions describing the states in which the system can be when different use case scenarios are performed. Larman calls the postconditions success guarantee (Larman 2004) to state what must be true on successful completion of a use case. Cockburn ( 2001 ) considers two types of postconditions—minimal guarantee and success guarantee—to address the fact that the use case goal may be fully delivered, partially delivered, or abandoned. The minimal guarantee corresponds to the failure scenarios’ result and specifies the least promise of a use case. The success guarantee extends the minimal guarantee when the use case goal is fully achieved. Here, the minimal guarantee is implicitly included in the success guarantee ( Metz et al. 2003 ). In the examples presented in this entry, the term postconditions is used to denote the success guarantee, and the term failure postconditions is used to represent the minimal guarantee. For example, the postconditions (success guarantee) defined in the Place Order use case are “an order has been submitted” (cf. Table E.2 ), and the Get Demand use case defines the postconditions “the copy of the demand is delivered to the worker” and “the state of the original demand is changed to in process” (cf. Table E.1 ).
Use Case Types
In addition to the three degrees of detail in use case description (cf. the Use Cases section), use cases can be divided by their system visibility into black-box and white-box use cases. Moreover, although the use case model approach targets software systems, sometimes use cases may be used to describe business processes.
Black-Box and White-Box Use Cases
In practice, the black-box use cases are the most common type because they emphasize the functionality of the system in question without revealing any internal details of the system. Note that use cases are a requirements engineering approach (see Requirements Engineering: Principles and Practice, p. 949), and thus, they should not deal with the system’s internal workings, which should be targeted by the system design. The black-box use cases do not reveal the internal mechanisms of the system in question. Instead, the use cases are presented in the form of “responsibilities” (Larman 2004) of the system, presenting what the system must do but not how it will do it.
On the contrary, the so-called white-box use cases look inside the system. Such use cases involve internal system components and their behavior. Moreover, when dealing with white-box use cases, we must consider internal actors as well as external ones ( Cockburn 2001 ).
System and Business Use Cases
A use case model targets the functional requirements of a system. Here, often the use cases forming a use case model are called system use cases. Because such use cases are usually intended to capture the users’ goals in the system in question, they are also called user-goal use cases. In terms of system visibility, the system use cases are of black-box or white-box format. Note that it is a good practice, though, to write the system use cases as fully dressed black-box use cases ( Cockburn 2001 ). For example, both Get Demand (cf. Table E.1 ) and Place Order (cf. Table E.2 ) use cases are such system use cases.
Usually, the use case model of a system tackles particular business requirements imposed by the business that uses the system. Although the use case model of a system does not capture the business itself, the use case approach can be used to define business processes. In this case, the use cases are called business use cases ( Bittner et al. 2003 ; Larman 2004). Thus, with such use cases, we describe a business not a system. For example, in a coffee store, a possible business use case could be “Make Coffee.” The actors of such use cases are actors in the business environment (customers, suppliers, shareholders, etc.) (Larman 2004). Business use cases might be very useful if there is a need to understand the business context where a system is going to be used.
Use-Case-Associated Diagrams
UML (Larman 2004) provides notations for drawing use case diagrams, where we distinguish actors performing use cases. In addition, UML sequence diagrams may be used to depict use case scenarios.
Use Case Diagram
A use case diagram visualizes and conveys the structure of the use case model of a system. Here, a use case diagram shows interactions between a system and the use case actors (cf. the Use Case Actors section). An actor represents a specific role in one or more interactions with the system expressed through use cases. Conceptually, a use case diagram is a graph where the nodes represent both actors and use cases, and the lines represent relationships among use cases and actors. Naturally, the use case diagrams have low information content, and they are complementary documents meant to assist the use case textual descriptions (cf. Tables E.1 and E.2).
UML ( Booch et al. 2005 ) provides appropriate notations for depicting actors, use cases, and relationships. Here, a use case is represented by an ellipse that can be labeled. An actor is usually drawn as a named stick figure or, alternatively, as a class rectangle with the «actor» keyword. As for the relationships, UML introduces notations for four different types of relationships found in use case models:
- Association (UML notation: solid line) . An association determines the communication path between an actor and the associated use case. In general, an association exists whenever an actor is involved in an interaction described by a use case; that is, an actor is involved in a use case. Thus, associations connect use cases with primary, supporting, and offstage actors. The UML notation for associations is a solid line with an optional arrowhead at one end of the line. The arrowhead indicates the direction of the initial invocation of the actor–use case interaction.
- Generalization (UML notation: solid line with closed arrowhead) . The generalization relationship denotes a relationship between a more generic use case (or actor) and a more specific use case (or actor), where the latter inherits features from the former. Here, use case features are scenarios and actor features are behavior. A generalization is drawn as a solid line with a closed arrowhead pointing toward the generalized use case (or actor), as shown in the example below. From the generalization relationship perspective, a use case diagram can be viewed as a special UML class diagram with two special kinds of classes, where classes of the same kind can be connected by a generalization arrow.
- Extend (UML notation: dashed line with open arrowhead and the «extend» keyword) . The extend relationship denotes the insertion of additional behavior (use case scenarios) into a base use case where the latter does not know about it. In general, the incorporation of the extension use case depends on what happens (and under what conditions) when the base use case executes. Note that the extension use case owns the extend relationship; that is, the arrow points toward the extended use case. Also, it is possible to specify several extend relationships for a single base use case.
- Include (UML notation: dashed line with open arrowhead and the «include» keyword) . The include relationship denotes the additional behavior included in a base use case that explicitly defines the inclusion. Thus, the base use case owns the include relationship; that is, the arrow points toward the included use case. It is a good practice to use the include relationship when multiple use cases have a common function that can be shared by all.
A use case diagram may also include an optional system boundary box, which is denoted as a rectangle around all the use cases. A system boundary box indicates the scope of the system in question. Anything within the box represents functionality that is in the scope of the system and anything outside the box is not. Although system boundary boxes are rarely used, they can be used to identify functionality of different releases of a system, that is, which functional requirements (denoted by use cases) will be fulfilled by which major releases of a system.
Figure E.3 is an example of a use case diagram covering most of the UML notations for use cases. This is a simple solution to the famous elevator use case model problem. As shown, this use case model consists of three actors and five use cases connected through different relationship links. Here, the security personnel is the only actor performing the “go to basement” use case, but this actor could be a regular visitor as well (denoted by the generalization relationship). In addition, the “go to floor” use case is extended by the “request help” use case, and “service elevator” is a complex use case including two other use cases. As you can see, the diagram itself does not say much about the use cases. In fact, the diagram helps us perceive the overall system functionality in terms of actors’ goals depicted by the use cases. However, we need the textual use case description (use case scenarios) to understand how the actors interact with the system in order to achieve their goals.
Figure E.3 Simple elevator use case model.
Use Case Scenario Diagrams
In addition to the UML use case diagrams, UML sequence diagrams ( Booch et al. 2005 ) may be used to graphically depict the use case scenarios. Although UML sequence diagrams are typically used at the software design stage to describe object- oriented software systems, they may be successfully used as process flow diagrams to depict the sequence of actions and interactions forming the steps of a use case scenario. The following elements describe some of the remarkable UML notations for sequence diagrams (SDs) ( Booch et al. 2005 ):
- The SDs are two-dimensional. Here, the horizontal dimension is used to depict objects participating in interactions (e.g., actors and the system in question), and the vertical dimension is used to depict the time line.
- There is no significance to the horizontal ordering of the interacting objects.
- Each object is shown in a separate column.
- Each object has a lifeline denoted by a dash or a double solid line. The dash line means the object is created but not active. The double solid line means the object is active.
- The objects interact via messages.
- Each message is shown as an arrow from the lifeline of the object that sends the message to the lifeline of the object that receives the message.
Figure E.4 depicts the graphical representation of the basic scenario of the Place Order use case (cf. Table E.2 ). Note that the system and the DP actor are depicted in the diagram as single objects.
Figure E.4 UML sequence diagram: “place order” basic scenario.
Best Practices
One of the most challenging problems in use case modeling is discovering use cases. Larman ( 2004 ) narrows down the problem to the appropriate level and scope at which a use case should be expressed. The suggested level is the so-called level of elementary business process (EBP).
The latter is similar to the term user task in usability engineering ( Nielsen 1993 ) defined by Larman ( 2004 ) as follows:
- A task performed by one person in one place at one time, in response to a business event, which adds measurable business value and leaves the data in a consistent state.
- For example, Get Demand (cf. Table E.1 ) and Place Order (cf. Table E.2 ) are EBP-level use cases. Unable to define the right level of EBP for the system in question, developers may define many use cases at a very low level; for example, a single step of action. Here, a wrong use case will be “push button.”
Larman ( 2004 ) calls the EBP-level use cases user goal-level use cases. Such use cases are used by the primary actors (cf. the Use Case Actors section) to achieve their goals in the system. This approach conceives the following recommended procedure for discovering user goal-level use cases (Larman 2004):
- Find the user goals of every primary actor.
- Define a distinct use case for each user goal.
Cockburn ( 2001 ) calls use cases actor’s contracts with the system under design. Here, in order to easily discover use cases, we should think about a use case as “the primary actor’s goal, calling upon the responsibility of the system under design.” Here, identifying the user goals is of major importance for developing a successful use case model.
In addition, we often have to consider the so-called subgoals that support a user goal. Larman ( 2004 ) calls such subgoals subfunction goals. Use cases capturing subgoals are usually written as supplementary use cases included (cf. the Use Case Diagram section) in the user goal-level use cases. For example, both Disable Elevator and Enable Elevator use cases are subgoal use cases included in the Service Elevator use case (cf. Figure E.3 ).
Algorithm for Determining Use Cases
Considering the fact that use cases are functional requirements defined to help system users achieve their goals in the system under consideration, Larman ( 2004 ) proposes an algorithm for defining use cases. The following is an extended version of this algorithm:
- Determine the system boundary. The latter clearly separates the actors’ intentions from the system’s responsibilities.
- Identify the primary actors. Remember that the primary actors have goals that should be achieved by using the services of the system.
- For each primary actor identify the user goals. The primary actor goals should be defined at the level of EBP.
- Define use cases that will help primary actors achieve their user goals. It is a good practice to name use cases according to their goal. These are the user goal-level use cases.
- Identify the subgoal use cases. Usually, these are low-level use cases included in the user goal-level use cases.
- Identify the supporting actors providing supporting services to the system. The supporting services should be required by the use cases.
- Identify the offstage actors. Because these actors are not directly involved in any use case, they should be explicitly named by the system stakeholders or logically deducted.
Use Case Benefits and Traps to Avoid
Today, use cases are commonly used as a primary and effective technique in requirements engineering for capturing and communicating functional requirements for software development. Much of the use case popularity is probably due to the many benefits that result because of their use. Some of the use case benefits are given as follows:
- Emphasizes user goals and objectives.
- Users and other stakeholders become more involved in the process of requirements engineering.
- Provides common notation understandable to both professionals and nonprofessionals.
- Use cases are action-oriented and focused on system functionality—system functionality is decomposed into a set of discrete tasks.
- Helps developers derive test cases and some design insights.
- It may be reused for user documentation (both text and diagrams).
- It may be used as a basis for planning iterative work.
- It may be used as the so-called þ1architecture view of the 4þ1 design view model ( Kruchten 1995 ), where a small set of useful and important scenarios are used to demonstrate how a system is going to work.
However, in order to benefit from use cases, there are a few well-known traps that we must avoid when applying the use case approach:
- Too many use cases. This problem arises when there are use cases not defined at the right EBP level. Moreover, often a use case represents a single requirement. Note that it is a good practice to define use cases representing a common group of requirements.
- Scenario duplication across use cases. Scenario duplication means redundancy. To avoid duplication, define supplementary use cases and use the include relationship (cf. the Use Case Diagram section).
- Use case name duplication. Use cases must be named with unique names across a use case model.
- User interface design included in use cases. A use case should not emphasize the system user interface, but the system functionality.
- Data definitions included in use cases. Note that data requirements are nonfunctional and should be tackled by other requirements engineering approaches (cf. Requirements Engineering: Principles and Practice, p. 949), such as the domain model approach (Larman 2004).
ATM Use Case Model: A Case Study
To demonstrate the use case concepts revealed in the Use Case Concepts section, this section presents a case study on how to develop a use case model for an ATM.
Problem Description
Users log on to the system using their ATM card and personal identification number (PIN). After logging in, public clients can deposit, transfer, or withdraw money, or pay their public services bills. Commercial clients can deposit money or print out their monthly transaction report. The system technician can upload a statistics report on the ATM server (and optionally print it on the ATM machine’s printer), add some money in the machine, or shut it down. Any operation requiring a database access requires a data exchange with the ATM server. Any user can press an emergency button that will turn on the hidden camera and call the police department.
Discovering Actors and Use Cases
To describe the ATM use case model, we need to determine both actors and use cases. Next, we need to describe the use cases and relate them with the appropriate relationships. Here, we applied the algorithm described in the Algorithm for Determining Use Cases section:
-
Determine the system boundary. The system is ATM.
-
Identify the primary actors. All the actors should be nouns, entities with behavior. All the actors interact with the system, but only the primary actors have goals in the system. Here, the discovered primary actors are as follows:
- Public client
- Commercial client
- System technician
-
For each primary actor identify the user goals.
Recall that the primary actor goals should be defined at the level of EBP. The user goals of the different primary actors are as follows:
- Public client: deposit money, transfer money, withdraw money, pay bills, emergency (the act of emergency call).
- Commercial client: deposit money, print transaction report, emergency.
- System technician: add money, shut down ATM, upload statistics report, print statistics report, emergency.
-
Define use cases that will help primary actors achieve their user goals. Here, the identified user goal-level use cases have the same names as the user goals identified at 3.
-
Identify the subgoal use cases. Recall that these are low-level use cases usually included in the user goal-level use cases. Here, the identified subgoal use cases are as follows:
- Log on—a user must be logged on to the system in order to perform operations.
- Data exchange—any operation requiring a database access requires a data exchange with the ATM server.
-
Identify the supporting actors providing supporting services to the system. Recall that any supporting service needs to be required by the use cases. Following are the identified supporting actors:
- ATM server—maintains data needed by the ATM.
- Printer—prints reports.
-
Identify the offstage actors. Both the police department and the camera may be considered as offstage actors.
- Police Department—eventually, secures the ATM.
- Camera—eventually, observes the ATM.
Writing Use Cases
Due to space limitations, only the description of one use case is presented here. Table E.3 presents a fully dressed description (cf. the Use Cases section) of the “log on” use case.
Table E.3 Use Case “Log On.” | Name | Log on | | --- | --- | | Actor | Public client, commercial client, system technician | | Description | Users log on to the system by using their ATM card and PIN. | | Related use cases | This use case is included in the use cases “withdraw money,” “deposit money,” “transfer money,” “pay bills,” “add money,” “shut down ATM,” “print transaction report,” “upload statistics report,” and “print statistics report.” In addition, this use case includes the use case “data exchange.” | | Preconditions | The user has an ATM card and a PIN number. | | Basic Scenario |
- A user puts the card in the card reader slot.
- The ATM validates the card information.
- The ATM requires the user’s PIN.
- The user enters the PIN.
- The ATM validates the PIN.
- The ATM grants the user with access to specific ATM operations.
| | Alternative | 5.1. The PIN number is not valid.
- 5.1.1. ATM informs the user that the PIN is invalid.
- 5.1.2. Continue with 4.
| | Failure #1 | 2.1. The ATM rejects the card.
- 2.1.1. ATM informs the user that his/her card is invalid.
- 2.1.2. ATM returns the card.
| | Failure #2 | 5.1.2.1. The user cancels the operation.
- 5.1.2.1.1. ATM returns the card.
| | Failure conditions #1 | The card is not valid. | | Failure conditions #2 | The PIN is not valid. | | Postconditions | The user is logged on to the system. |
Drawing Use-Case-Associated Diagrams
Based on the discovered use cases and actors (cf. the Discovering Actors and Use Cases section) and on the description of the use cases (cf. the Writing Use Cases section; note that in reality all the use cases should be described), we draw the use case diagram representing the use case model of the ATM system (cf. Figure E.5 ).
Figure E.5 ATM use case model.
In addition, UML SDs may be used to graphically represent the use case scenarios. These diagrams will have similar format and features as the one presented in the Use Case Scenario Diagrams section.
Summary
This entry has presented the concepts and techniques behind use cases, which are widely recognized as a valuable approach to discovering and documenting functional requirements. Conceptually, use cases are special stories of using a system expressed with a flow of events defining scenarios of system use. The emphasis is on the user goals and on how the system works with the users to achieve their goals. Here, the system users are presented as actors playing a specific role in use cases. The advantage is that use cases are understandable to both users and developers, and users and other stakeholders become more involved in the process of requirements engineering.
In general, use cases are text documents, often accompanied by associated diagrams. The latter are special UML diagrams illustrating the use case model of the system in question and helping system stakeholders better understand the user–system interaction process. The use case description is considered to be of major importance because it documents the flow of events between the actors and the system. Use cases can be written in different formats and different degrees of detail in use case description. For example, use cases may provide a fully dressed description, where all steps of all the possible use case scenarios are explained in detail. A single use case may result in multiple possible scenarios each presenting a distinct flow of events that may occur during the performance of a use case by an actor. The description of a use case may encompass three different types of scenarios—basic scenario, alternative scenario, and failure scenario. In addition, different types of use cases are known. Use cases can be grouped by system visibility into black-box and white-box use cases. In addition, use cases may target not only software systems but also business processes.
In this entry, to demonstrate the concepts and flavor of the use case approach, a case study example has been presented. Here, a use case model of an ATM system has been developed by applying the concepts and techniques presented in this entry. To conclude the entry, it should be noted that today use cases are commonly used as a primary and effective technique in requirements engineering for capturing and communicating functional requirements for software development. Use cases are so popular because they provide a shared vision of software requirements by bridging the gap between the people who understand the problem and the people who know how to build the system solving that problem.
References
- Bittner, K., Spence, I., & Jacobson, I. (2003). Use Case Modeling . Addison-Wesley, Boston, MA.
- Booch, G., Rumbaugh, J., & Jacobson, I. (2005). Unified Modeling Language User Guide , 2nd edition. Addison-Wesley, Boston, MA.
- Cockburn, A. (2001). Writing Effective Use Cases . Addison-Wesley, Boston, MA.
- IEEE Std. (1998). IEEE-Std-830–1998: IEEE Recommended Practice for Software Requirements Specification . IEEE Computer Society, Los Alamitos, CA.
- Jacobson, I., Booch, G., & Rumbaugh, J. (1999). The Unified Software Development Process . Addison-Wesley, Boston, MA.
- Kruchten, P. (1995). Architectural Blueprints—The “4þ1” View Model of Software Architecture . Rational Software Corp., Rockford, MI.
- Kulak, D., & Guiney, E. (2003). Use Cases: Requirements in Context , 2nd edition. Addison-Wesley Professional, Boston, MA.
- Larman, C. (2004). Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development , 3rd edition. Prentice Hall PTR, Upper Saddle River, NJ.
- Metz, P., O’Brien, J., & Weber, W. (2003). Specifying use case inter-action: Types of alternative courses. Journal of Object Technology , 2(2): 111–131.
- Nielsen, J. (1993). Usability Engineering (Interactive Technologies ). Morgan Kaufmann, San Francisco, CA.
- Royce, W. (1998). Software Project Management: A Unified Framework . Addison-Wesley, Boston, MA.
- Simons, A. (1999). Use cases considered harmful. In R. Mitchell, A. C. Wills, J. Bosch & B. Meyer (Eds.), Proceedings of the Technology of Object-Oriented Languages and Systems (TOOLS—29 Europe ) (pp. 194–203). IEEE Computer Society, Los Alamitos, CA.
- Spence, I., & Bittner, K. (2004). Managing Iterative Software Development with Use Cases . White Paper. IBM Corp. http://www.ibm.com/developerworks/rational/library/5093.html (accessed November 2009).
- Vassev, E. (2009). General Architecture for Demand Migration in Distributed Systems . LAP Lambert Academic Publishing, KÖln, Germany.