Anda di halaman 1dari 36

Lecture 8 Use Case Diagrams

Based on Chapter 6 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design Using UML, (3rd Edition), McGraw Hill, 2006.
L 11.1

Drawing Use Case Diagrams




Purpose  Document the functionality of the system from the users perspective  Document the scope of the system  Document the interaction between the users and the system using supporting use case descriptions (behaviour specifications)
L 11.2

Use Case Diagrams




Use case diagrams are helpful in three ways:  Determine features (requirements) of the system;  Communicating with clients.  Generating test cases

L 11.3

Notation of Use Case Diagrams


Communication association Use case

Change a client contact Staff Contact Actor System or subsystem boundary

L 11.4

Notation of Use Case Diagrams




Actors  Drawn as stick people with a name  The roles that people, other systems or devices take when communicating with a particular use case or use cases  Not the same as job titles or people  People with one job title may play the roles of several actors (e.g. lecturer can be a customer or student)  One actor may represent several job titles (e.g. member of a company)
L 11.5

Actors
Actors are discovered by examining: Who directly uses the system Who is responsible for maintaining the system External hardware used by the system Other systems that need to interact with the system

L 11.6

Notation of Use Case Diagrams




Use Cases  Drawn as ellipses with a name in or below each ellipse  Describe a sequence of actions that the system performs to achieve an observable result of value to an actor  The name is usually an active verb and a noun phrase
L 11.7

Basic Use-Case Symbols


Use case subset of the overall system functionality  Represented graphically by a horizontal ellipse/oval shape with the name of the use case appearing above, below, or inside the ellipse. Actor anything that needs to interact with the system to exchange information.  Could be a human, an organization, another information system, an external device, or even time.
L 11.8

Use Case Notation/Narrative


Title Actor Use Case Name of the system

Use Case Name


Communication Association System Boundary
Use Case Name

Rectangular box encasing use cases ONLY


L 11.9

Notation of Use Case Diagrams




Communication Associations  Line drawn between an actor and a use case  Can have arrow heads to show where the communication is initiated (arrow points away from the initiator)  Represent communication link between an instance of the use case and an instance of the actor (e.g. which student enrols which course)
L 11.10

Notation of Use Case Diagrams




Sub-Systems  Drawn as a rectangle around a group of use cases that belong to the same sub-system  In a CASE tool, use cases for different subsystem are usually placed in separate use case diagrams, and the rectangle is redundant

L 11.11

Notation of Use Case Diagrams




Dependencies  Extends and Includes relationships between use cases  Shown as stereotyped (label) dependencies  Stereotypes are written as text strings in guillemets: extends and includes

L 11.12

Notation of Use Case Diagrams




Extends (extension) Relationship  One use case provides additional functionality that may be required in another use case  There may be multiple ways of extending a use case, which represent variations in the way that actors interact with the use case  Extension points show when the extension occurs  A condition can be placed next to the dependency arrow
L 11.13

Use Case Extends Relationship


Extends Association when you have 1 use case that is similar to another use case but does a bit more or is more specialized=subclass  Relationship between the extension use case and the use case it is extending is called an extends relationship.  Represented as an arrow headed line beginning at the extension use case and point to the use case it is extending.  Each extends relationship line is labeled <<extends>>. L 11.14


Use Case Extends Relationship  In Fig below, the Generate Warehouse Packing Order use case extends or enhance the functionality of the Place New Member Order use case by capturing additional actions that need to be performed in the generation of warehouse packing order
Child/subclass Child

Parent

L 11.15

<<extends>>
Used

when you wish to show that a use case provides additional functionality that may be required in another use case.

Summary,

extends association is found when you add a bit more specialized, new use case that extends some of the use case that you have

L 11.16

<<extends>>
Figure

below shows use case Print Campaign summary extends Check Campaign Budget Means that a particular point in the Check Campaign Budget the use can optionally invoke the behaviour of Print Campaign Summary (eg: print out the information in this case)
Check Campaign budget Super class

<<extends>> sub class Print Campaign summary Extension of use case


L 11.17

<<EXTENDS>>
Class Registration Student <<extends>> Registration for Special class Registration Clerk <<extends>> Prereq courses not completed

Student Billing Instructor Office


L 11.18

Registration for special class use case extends the Class registration use case by capturing the additional actions that need to be performed in registering a student for special class Class Registration basic course, which is always performed independent of whether the extension is performed or not Registration for Special Class alternative course, only performed under special circumstances
L 11.19

Extends Relationship
Check campaign budget Extension points Summary print: system displays balance extends user requires print-out Campaign Manager Print campaign summary

L 11.20

Notation of Use Case Diagrams (8)




Includes/Uses Relationship  One use case always includes the functionality of another use case  A use case may include more than one other  Can be used to separate out a sequence of behaviour that is used in many use cases  Should not be used to create a hierarchical functional decomposition of the system
L 11.21

Library Information System Borrow books

<<uses>>

Check library card Circulation Return books <<uses>> clerk


<<uses>>

Member Interlibrary loan

Purchase supplies

librarian
L 11.22

Eg : Checking a library card is common among borrow books, return book and interlibrary loan use cases Summary, when you want to share common sequences in several use cases, utilize use association by extracting common sequences into a new, shared use case

L 11.23

Includes Relationship

Assign staff to work on a campaign Campaign Manager

includes Find campaign

L 11.24

Figure above shows that use case Assign staff to work on campaign has an <<include>> relationship with Find campaign It means that when Campaign Manager uses Assign staff to work on a campaign the behavior of Find Campaign will also be included in order to select the relevant campaign

L 11.25

<<USES>>

Specialized class

Reorder Supplies

Supplier
Track sales and Inventory data

<<uses>> Manager <<uses>>

Generalized class
Project Management Reports
L 11.26

 

When a Manager reorder supplies, the sales and inventory data are tracked When management reports are produced, there is another uses relationship between the Produce Management Reports and Track Sales Inventory Data use case Track Sales and Inventory Data Generalized use case represent the common behavior among the specialized use cases, Reorder Supplies and Produce Management Report Thus, when Reorder Supplies or Produce Management reports is performed, the entire Track Sales and Inventory Data is used
L 11.27

Notation of Use Case Diagrams




Generalization  Shows that one use case provides all the functionality of the more specific use case and some additional functionality  Shows that one actor can participate in all the associations with use cases that the more specific actor can plus some additional use cases
L 11.28

Record completion of an advert Staff Contact

Change a client contact

Assign individual staff to work on a campaign Campaign Manager Assign team of staff to work on a campaign

Assign staff to work on a campaign

L 11.29

Use Case Descriptions




Can be a simple paragraph Assign staff to work on a campaign




The campaign manager wishes to record which staff are working on a particular campaign. This information is used to validate timesheets and to calculate staff year-end bonuses.

L 11.30

Use Case Descriptions




Can be a step-by-step breakdown of interaction between actor and system


Assign staff to work on a campaign
System Response 2. Lists all campaigns for that client. 4. Displays a list of all staff members not already allocated to this campaign. 6. Presents a message confirming that staff have been allocated.

Actor Action 1. The actor enters the client name. 3. Selects the relevant campaign. 5. Highlights the staff members to be assigned to this campaign.

Alternative Courses Steps 13. The actor knows the campaign name and enters it directly.

L 11.31

Use Case Descriptions




Many projects use templates  name of use case  pre-conditions  post-conditions  purpose  description  alternative courses  errors
L 11.32

Drawing Use Case Diagrams step by step


1. 2. 3.

4.

Identify the actors and the use cases Prioritize the use cases Develop each use case, starting with the priority ones, writing a description for each Add structure to the use case model: generalization, include and extend relationships and sub-systems
L 11.33

Summary
In this lecture you have learned about:  The purpose of use case diagrams  The notation of use case diagrams  How to draw use case diagrams  How to write use case descriptions  How prototyping can be used with use case modelling
L 11.34

References
  

Jacobson et al. (1992) Rosenberg and Scott (1999) Cockburn (2000)

(For full bibliographic details, see Bennett, McRobb and Farmer)

L 11.35

Exercise


A new shopping complex is open in your locality. You have been asked to model an information kiosk for shoppers. Casual shoppers may use it to find out where a particular named shop is, where they can buy certain goods or what facilities are available. Shop renters in the complex can use the same system to book function rooms, special cleaning or security facilities. To use this, they must enter a username and password. When a new outlet is opened, or one changes hands, the complex manager updates the L 11.36 information on the system.

Anda mungkin juga menyukai