Use Case Diagrams

ICT2622 - Object-Oriented Analysis · Object-Oriented Modelling Techniques

Use Case Diagrams

Use case diagrams are a key component of the Unified Modeling Language (UML). They help to visualise the interactions between users (actors) and the system. These diagrams provide a high-level overview of the system's functionality from the user's perspective.

Actors

An actor represents a user or another system that interacts with the system being designed. Actors can be primary or secondary. A primary actor initiates an interaction with the system, while a secondary actor provides support or assistance to the primary actor.

Remember: Actors are not part of the system; they exist outside of it.

Use Cases

A use case describes a specific function or feature of the system from the user's perspective. It outlines the steps the actor takes to achieve a goal. Each use case should have a clear title and a brief description of its purpose.

Creating a Use Case Diagram

To create a use case diagram, follow these steps:

  1. Identify the actors involved with the system.
  2. Identify the use cases that the actors will interact with.
  3. Draw the use case diagram, placing actors outside the system boundary and use cases inside.

Example of a Use Case Diagram

Consider a simple online shopping system. The primary actor is the customer, and the use cases include:

  • Browse Products
  • Add to Cart
  • Checkout

The use case diagram for this scenario would look like this:

<Use Case Diagram>
Customer --> (Browse Products)
Customer --> (Add to Cart)
Customer --> (Checkout)
</Use Case Diagram>

In this diagram, the customer interacts with three use cases: browsing products, adding items to the cart, and checking out.

System Boundary

The system boundary defines the scope of the system. It is represented by a rectangle that encloses the use cases. Everything inside the rectangle is part of the system, while everything outside is not.

Tip: Clearly define the system boundary to avoid confusion about what is included in the system.

Relationships in Use Case Diagrams

There are several types of relationships in use case diagrams:

  • Association: A line connecting an actor to a use case, indicating interaction.
  • Include: A relationship where a use case includes the functionality of another use case. This is used when a use case is always performed as part of another use case.
  • Extend: A relationship where a use case can extend the behaviour of another use case under certain conditions.

Example of Relationships

In the online shopping system, consider the use case