Use Case Diagrams

Laurie Williams, Dright Ho, and Sarah Smith
CSC 326 - Software Engineering
Department of Computer Science
North Carolina State University

Back to Software Engineering Tutorials

0.0 Outline
1.0 Background on UML, Eclipse UML, and Use Case Diagrams
2.0 Creating an Use Case Diagram
3.0 Creating Objects in an Use Case Diagram
4.0 Tips and Tricks
5.0 Exercise
6.0 Resources

1.0 Background on UML, Eclipse UML, and Use Case Diagrams


UML (Unified Modeling Language) was developed by Grady Booch, James Rumbaugh, and Ivar Jacobson, at Rational Software Corporation in 1997, for a standard way to model the structure of large applications. The UML is a standard maintained by the Object Management Group (OMG). The current version of UML is 2.0. UML provides a standardized way of modeling software, so the everyone can understand a given model. UML has several different modeling types: class diagram, sequence diagrams, state charts, and use cases to name a few. This tutorial will introduce programmers to creating class diagrams in Eclipse UML.

Eclipse UML

Eclipse UML is an Eclipse plug-in developed my Omondo. There is a free edition and a studio edition of Eclipse UML. The free edition will cover the modeling needs for CSC 326. You can download Eclipse UML here. After you have downloaded Eclipse UML, double click the jar file, which will then run an installer program. This will install Eclipse UML as a plug-in. We are using Eclipse UML release You need to have the Eclipse Modeling Framework (EMF), Graphical Editor Framework (GEF) and UML2 Eclipse plug-ins installed. These are all Eclipse projects, and you can install them by connecting to the Eclipse update site inside of Eclipse (see Installing Plugins in Eclipse tutorial)

Use Case Diagrams

A use case is a functionality the users need from the system. A use case diagram depicts the relationships among the actors and use cases. It is usually used for requirements analysis. The components in a use case diagram include:

  • Actors: Actors represent external entities of the system. These can be people or things that interact with the system that is being modeled. For example, if we are modeling an online store we have many actors that interact with the store functionality. The customer browses the catalog, chooses items to buy, and pays for those items. A stocker will look at the orders and package items for the customer. A billing system will charge the customer's credit card for the amount purchase.
  • Use Cases: Use cases are functional parts of the system. When we say what an actor does, that's a use case. The customer "browses the catalog", "chooses items to buy", and "pays for the items". These are all use cases. Many actors can share use cases. If we find a use case that is not associated with any actor, this may be a unnecessary functionality.
  • Associations: Associations are shown between actors and use cases, by drawing a solid line between them. This only represents that and actor uses the use case.

There are also two kinds of relationships between use cases:

  • Includes: Use cases that are associated with actors can be very general. Sometimes they "include" more specific functionality. For example, the "pump gas" use case that is associated with the customer includes three use cases: Choose Gas Type, Fill Tank, and Calculate Total. Includes relationship is represented by dashed arrows that point to the included functionality. Beside the arrow is <<includes>>.
  • Extends: An extension use case is an insertion to the base use case. For example, some stores may allow for different payment options like credit card, debit card, or cash on delivery. These specific functionalities are extension of the general "pay for items." Extends relationship is represented by dashed arrows that point to the base functionality. Beside the arrow is <<extends>>

For more detailed information about Class Diagrams, check out Chapter 9 in Martin Fowler's UML Distilled.

Top | Contents
2.0 Creating a Use Case Diagram

Since Use Case diagrams model a system's requirements, use cases are not tied to the code in a project.

The use case diagram file is stored in the source directory or package of the associated source code. You can also create use case diagrams in another folder of the project.

2.1 There are three ways to create a use case diagram:

2.1.1 Select File > New > Other... > UML Diagrams > UML Use Case Diagram,

2.1.2 Select the arrow of the button in the upper left of the toolbar. Select Other... > UML Diagrams > UML Use Case Diagram, or

2.1.3 Right click on the source folder of package that you want to create a sequence diagram in and select New > Other... > UML Diagrams > UML Use Case Diagram.

2.2 Press Next. Give the use case diagram a file name. All use case diagrams end in a .uud extension.

Top | Contents
3.0 Creating Objects in a Use Case Diagram

Below are the icons on the use case diagram tool bar. These are displayed at the top of the Use Case Diagram editor window. A discussion of each of the tools is also below.

  • : Selects a component of a use case diagram
  • : Zooms in on the use case diagram
  • : Creates an actor that interacts with use cases
  • : Creates a use case
  • : Creates a system which groups use cases.
  • : Creates a generalization relationship between use cases.
  • : Creates an extends or includes relationship between use cases. Make sure that you select the right one by looking at the context information.
  • : Creates an association between two use cases or an actor and a use case
  • : Creates an indication between two use cases or an actor and a use case
  • : Creates a note
  • : Creates a link
  • : Creates a label

To add one of these components to a diagram, select the component and drag the curser from a starting point to an ending point in the editor. When you are creating an use case or actor, you will need to drag a rectangle of the size you want the use case or actor to be in the diagram. The connector icons will need to be dragged from a source object to a destination object.

Creating a Use Case

When you create a use case, you have the ability to enter more information about the use case than just the name. This will allow you to keep your requirements accessible from your code, so that you may reference them when you have any questions. You can store pre conditions, post conditions, rank, normal flow, alternative flow, and the use case description as meta-data of the use case.

Top | Contents
4.0 Tips and Tricks

4.1 If you wish to see more of your use case diagram you can zoom out using the zoom feature located in the toolbar.

Top | Contents
5.0 Exercise

Import the CoffeeMaker project into your workspace. Create a use case diagram in that models the requirements of the system. The CoffeeMaker requirements and a sample use case diagram may be found here.

Show your use case diagram to your TA for credit.

Top | Contents
6.0 Resources
Top | Contents

Back to Software Engineering Tutorials

Use Case Diagrams in Eclipse Tutorial ©2003-2005 North Carolina State University, Laurie Williams, Dright Ho, Sarah Smith
Email Sarah Smith with any questions or comments about this tutorial.
Last Updated: Tuesday, September 20, 2005 2:57 PM