Use Case Tutorial for Dummies

What is a Use Case?

A use case is a methodology used in system analysis to identify, clarify, and organize system requirements.

Use Case Diagram

use case diagram models different types of users interact with the system to solve a problem. As such, it describes the goals of the users, the interactions between the users and the system, and the required behavior of the system in satisfying these goals.

Use cases define interactions between external actors and the system to attain particular goals. A use case diagram contains four main components

(Edit the Use Case Diagram Example Above)

A use-case diagram consists of a number of model elements. The most important model elements are:

Actor

Actors are usually individuals involved with the system defined according to their roles. The actor can be a human or other external system.

Use Case

A use case describes how actors uses a system to accomplish a particular goal. Use cases are typically initiated by a user to fulfill goals describing the activities and variants involved in attaining the goal.

Relationship

The relationships between and among the actors and the use cases.

System Boundary

The system boundary defines the system of interest in relation to the world around it.

Use Case Characteristics

A use case (or set of use cases) has these characteristics:

  • Organizes functional requirements
  • Models the goals of system/actor (user) interactions
  • Records paths (called scenarios) from trigger events to goals
  • Describes one main flow of events (also called a basic course of action), and possibly other ones, called exceptional flows of events (also called alternate courses of action)
  • Is multi-level, so that one use case can use the functionality of another one.

Use Case and Use Case Scenario?

The use case is made up of a set of possible sequences of interactions between systems and users in a particular environment and related to a particular goal.

What Inside a Use Case?

It consists of a group of elements (for example, classes and interfaces) that can be used together in a way that will have an effect larger than the sum of the separate elements combined. The use case should contain all system activities that have significance to the users.

Type of Use Cases

Essential Use Cases are expressed in an ideal form that remains relatively free of technology and implementation details; design decisions are deferred and abstracted, especially those related to the user interface.

Concrete or Real Use Case concretely describes the process in terms of its real current design, committed to specific input and output technologies and so on. When a user interface is involved, they often show screen shots and discuss interaction with the widgets.

Abstract Use Case is not complete and has no actor that initiates it but is used by another use cases.

Structuring Use Cases

UML defines three stereotypes of association between Use Cases:

<<include>> Use Case

The time to use the <<include>> relationship is after you have completed the first cut description of all your main Use Cases. You can now look at the Use Cases and identify common sequences of user-system interaction.

<<extend>> Use Case

An extending use case is, effectively, an alternate course of the base use case. The <<extend>> use case accomplishes this by conceptually inserting additional action sequences into the base use-case sequence.

Abstract and generalized Use Case

The general use case is abstract. It can not be instantiated, as it contains incomplete information. The title of an abstract use case is shown in italics.

Example

This example depicts a model of several business use cases (goals) which represents the interactions between a restaurant (the business system) and its primary actors.

After the base use cases have been identified in the first cut, perhaps we could further structuring those use case with <<extend>> and <<include>> use cases in the second round touch up as shown in the Figure below:

(Edit the Use Case Diagram Example Above)

Structuring Use Cases with Packages

The use-case diagram may contain packages that are used to structure use cases to simplify analysis, development and maintenance of a system .

(Edit the Use Case Diagram Example Above)

Use Case Model vs Use Case Diagram

Much of the use-case model is in fact textual, with the text captured in the Use-Case Specifications that are associated with each use-case model element. These specifications describe the flow of events of the use case.

The use-case model serves as a unifying thread throughout system development. It is used as the primary specification of the functional requirements for the system, as the basis for analysis and design, as an input to iteration planning, as the basis of defining test cases and as the basis for user documentation.

Example: Use Case Description

  • To write the content of a use case, you begin by picking one of the scenarios as the main scenario.
  • You start the body of the use case by writing the main success scenario as a sequence of numbered steps.
  • You then take the other scenarios and write them as extensions. Extensions can be successes, as in 3a below or failure, as in 6b below.
  • Each use case has a primary actor, which calls on the system to deliver a service.
  • Each step in a use case is an element of the interaction between the user and the system.
  • A shared truck of activities in a use case may be reused by another use case through <include> use case.
  • In UML terms, we say that the first use case includes the second.

Buy a Product (Taken from UML Distilled p101)

Main Success Scenario:

  1. Customer browses catalog and selects item to by.
  2. Customer goes to the check out.
  3. Customer fills in shipping information
  4. System presents full pricing information
  5. Customer fills in credit card information
  6. system authorizes purchase
  7. System confirms sale
  8. System sends confirming email to customer

Extensions

3a: Customer is a regular customer

.1 System displays current shipping information

.2 Customer may accept or override

6a: System fails to authorize credit purchases

.1 Customer may reenter credit card information or may cancel

Use Case Description Illustrated by Visual Paradigm

Flow of Events and Extension

  • Records paths (called scenarios) from trigger events to goals

Use Case and UML Modeling

Use cases can be employed during several stages of software development, such as planning system requirements, validating design, testing software, and creating an outline for online help and user manuals. So what is the relationship of use case diagram with other UML diagrams in SDLC?

The choice of model is important

The choice of what models to create has a profound influence on how a problem is attacked and how a solution is shaped. We need to choose your models well.

  • The right models will highlight the most critical development problems.
  • Wrong models will mislead you, causing you to focus on irrelevant issues.

For Example: We can use different types of diagrams for different phases in software development.

References

Leave a Reply

Your email address will not be published.