You are on page 1of 31

Principles of Object Technology

Module 2: Modeling System Behavior with Use-Cases

Objectives: System Behavior


Understand the concept of system behavior and how to capture it in a model Understand the benefits of use-case modeling Understand how to create, read, and interpret use-case models and activity diagrams

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

Where Are We?


Concepts in use-case modeling Use-case diagram contents Understanding use-case specifications Creating activity diagrams

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

What Is System Behavior?


System behavior is how a system acts and reacts.
It is the outwardly visible and testable activity of a system

System behavior is captured in use cases.


Use cases describe the system, its environment, and the relationship between the system and its environment.

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

What Is a Use-Case Model?


A model that describes a systems functional requirements in terms of use cases A model of the systems intended functions (use cases) and its environment (actors)

View Report Card

Student

Register for Courses

Login

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

What Are the Benefits of a Use-Case Model?


Used to communicate with the end users and domain experts
Provides buy-in at an early stage of system development Insures a mutual understanding of the requirements

Used to identify
Who interacts with the system and what the system should do The interfaces the system should have

Used to verify
All requirements have been captured The development team understands the requirements
<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

Major Concepts in Use-Case Modeling


An actor represents anything that interacts with the system. A use case is a sequence of actions a system performs that yields an observable result of value to a particular actor.

Actor

Use Case

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

Where Are We?


Concepts in use-case modeling Use-case diagram contents Understanding use-case specifications Creating activity diagrams

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

What Is an Actor?
Actors are not part of the system. Actors represent roles a user of the system can play. They can represent a human, a machine, or another system. They can actively interchange information with the system. They can be a giver of information. They can be a passive recipient of information.

Actor

Actors are EXTERNAL.


<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

Useful Questions in Finding Actors?


Who will supply, use, or remove information? Who will use this functionality? Who is interested in a certain requirement? Where in the organization is the system used? Who will support and maintain the system? What are the systems external resources? What other systems will need to interact with this one?

Actor

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

10

Focus on the Roles


An actor represents a role that a human, hardware device, or another system can play.

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

11

A User May Have Different Roles


Charlie as student

Charlie
Student

Charlie as professor
Professor

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

12

Practice: Find the Actors


In the Course Registration System Requirements document, read the Problem Statement for the Course Registration case study. As a group, identify the following
Actors Description of the actor

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

13

Practice: Solution
The external system responsible for student billing
Student

Billing System

A person who is registered to take courses at the University The unabridged catalog of all courses offered by the University

A person who is teaching classes at the University


Professor

Course Catalog

Registrar

The person who is responsible for the maintenance of the course registration system

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

14

What Is a Use Case?


A sequence of actions a system performs that yields an observable result of value to a particular actor

Use Case

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

15

Use Cases and Actors


A use case models a dialog between actors and the system. A use case is initiated by an actor to invoke a certain functionality in the system.

Actor
Communicates Association

Use Case

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

16

How to Find Use Cases


Answer the following questions to find use cases.
For each actor you have identified, what are the tasks the system would be involved in? Does the actor need to be informed about certain occurrences in the system? Will the actor need to inform the system about sudden, external changes? What information must be modified or created in the system?
<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

17

Naming the Use Case


The name indicates what is achieved by its interactions with the actor(s). The name may be several words in length. No two use cases should have the same name.

Register for Courses

Login Maintain Student Information


<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

18

How Would You Read This Diagram?


View Report Card

Student Register for Courses Maintain Professor Information Course Catalog

Login
Maintain Student Information

Select Courses to Teach


Registrar Professor

Submit Grades

Close Registration

Billing System

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

19

Where Are We?


Concepts in use-case modeling Use-case diagram contents Understanding use-case specifications Creating activity diagrams

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

20

Use-Case Specifications
Name Brief description Flows of Events Relationships Activity and State diagrams Use-Case diagrams Special requirements Pre-conditions Post-conditions Other diagrams
Use-Case Model

Actors Use Cases

...
Use-Case Reports

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

21

Use-Case Flow of Events


Has one normal, basic flow (Happy Path) Several alternative flows
Regular variants Odd cases Exceptional flows handling error situations
Happy Path

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

22

What Are Scenarios?


A scenario is an instance of a use case.

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

23

Where Are We?


Concepts in use-case modeling Use-case diagram contents Understanding use-case documentation Creating activity diagrams

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

24

What Is an Activity Diagram?


An activity diagram in the use-case model can be used to capture the activities in a use case. It is essentially a flow chart, showing flow of control from activity to activity.
Flow of Events This use case starts when the Registrar requests that the system close registration. 1. The system checks to see if registration is in progress. If it is, then a message is displayed to the Registrar and the use case terminates. The Close Registration processing cannot be performed if registration is in progress. 2. For each course offering, the system checks if a professor has signed up to teach the course offering and at least three students have registered. If so, the system commits the course offering for each schedule that contains it.

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

25

What Is an Activity State?


An activity state is an ongoing nonatomic execution that
Can be decomposed. May be interrupted and take some time to complete.

An activity state represents the performance of an activity or step within the workflow.

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

26

Example: Activity Diagram


Decision
[ add course ]

[ delete course ]

Delete Course

Activity State

Select Course

Synchronization Bar (Fork)


Check Schedule

Concurrent threads

Check Pre-requisites

Transition Guard Condition Synchronization Bar (Join)

[ checks completed ]

[ checks failed ]

Assign to course
[ student added to the course ]

Resolve conflicts

Update schedule

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

27

Swimlanes
Sales Fulfillment

Determine Need

Take Order

Fill Order Setup Payment

Deliver Order

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

28

Which Comes First?

OR

OR
Use-Case Specification Activity Diagram

It depends on how you prefer to work.


<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

29

Checkpoints: System Behavior


Have you found all the use cases? Do the use cases meet all the functional requirements? Does the use-case model contain any superfluous behavior. That is, does it present more functions than were called for in the requirements? By studying the use-case model, can you form a clear idea of the system's functions and how they are related?

<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

30

Checkpoints: System Behavior (continued)


Have you found all the actors? Is each actor involved with at least one use case? Can you name at least two people who would be able to perform as a particular actor? Do any actors play similar roles in relation to the system? Will a particular actor use the system in several different ways, or does he have several completely different purposes for using the use case?
<Course Title and Version Number> Copyright 2000 Rational Software, all rights reserved

31

You might also like