Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Use Case Modeling

Object‐Oriented Analysis and 
Design using UML (Part 2)  Object‐oriented analysis technique where the UML is 
fundamentally based from 
 Use Case Modeling  Use Case Model
 Use Case Relationships
• Logical model of the system describing the system’s 
 Creating Use Case Diagrams functional requirements in terms of use cases 
 Activity Diagrams • Consists of actors and use cases
 Class Diagrams
 Interaction Diagrams
 Generalization/Specialization 
(Gen/Spec) Diagrams
 Statecharts Diagrams
*Property of STI J0069
  *Property of STI J0069
 
1   _________________________    2  __________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Use Case Modeling Use Case Modeling

 Actor  Use Case

• Can be a human or machine entity that exists outside the  • Gives developer a view of what the users want 
system  • Sequence of transactions performed by a system 
• Interacts with the system in a specific way  • Produces a measurable result for a particular actor 
• Can be divided into two groups: • Describes three things: 

o Primary o An actor that initiates an event 
o Secondary o The event that triggers a use case
o The use case that performs the actions triggered by the event 

• Used to document a single transaction or event

   
*Property of STI J0069 *Property of STI J0069

3   _________________________    4  __________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Use Case Relationships Use Case Relationships

 Communicates

• Used to connect an actor to a use case 

*Property of STI J0069
  *Property of STI J0069
 
5   _________________________    6  __________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Use Case Relationships Use Case Relationships

 Includes  Extends
• Describes the situation in which one use case possesses the 
• Describes the situation in which a use case contains behavior  behavior that allows the new use case to handle a variation 
that is common to more than one use case  or exception from the basic use case 

   
*Property of STI J0069 *Property of STI J0069

7   _________________________    8  __________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Use Case Relationships Creating Use Case Diagrams

 Generalizes  Use Case Diagram
• Type of behavioral diagram defined by UML created 
• Implies that one thing is more typical than the other thing  from a Use‐case analysis 
• Present a graphical overview of the functionality 
provided by a system in terms of actors, their goals—
represented as use cases—and any dependencies 
between those use cases 
• Helpful in exposing requirements and in planning the 
project 
• Consists of a standard flow of events in the system that 
describes a standard system behavior 

*Property of STI J0069
  *Property of STI J0069
 
9   _________________________    10   ________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Creating Use Case Diagrams Creating Use Case Diagrams
 Use Case Diagram Example

 Use Case Diagram Guidelines

• Review the business specifications and identify the actors in 
the problem domain.  
• Identify the high‐level events and develop the primary use 
cases that describe those events and how the actors initiate 
them.  
• Review each primary use case to determine the possible 
variations of flow through the use case. 

   
*Property of STI J0069 *Property of STI J0069

11   ________________________    12   ________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Creating Use Case Scenarios Creating Use Case Scenarios
 Use Case Scenario Example
 Use Case Scenario Use case name: Withdraw Money
Actor(s): Bank Customer
Bank System
• Document that illustrates a procedure on how a user will use  Description: Customer withdraws cash from the ATM system by inserting his/her ATM card,
selecting a transaction, selecting an account, entering the correct PIN, and entering
a product  the amount. The ATM system validates the card, PIN, account, and amount with the
Bank System.
• Can include stories, examples, and drawings of GUIs  Steps Performed (Main Path)

• Has no standardized format  1.
2.
User inserts ATM card
ATM reads and validates Bank ID and account number with Bank System
• Includes three sections: 3.
4.
User selects transaction
User selects account
5. User enters PIN number
6. User enters amount to withdraw
o Use case identifiers and initiators 7. ATM updates amount with Bank Accounting System
8. ATM dispenses card, cash and receipt
o Steps performed 9. ATM logs transaction
o Conditions, assumptions, and questions 10. User takes card, cash, and receipt

Preconditions: 1. ATM has money and supplies


2. Bank Accounting System is working
Postconditions: 1. User’s account balance is adjusted
2. ATM’s money inventory is adjusted
3. ATM’s supply inventory is adjusted

*Property of STI J0069
  *Property of STI J0069
 
13   ________________________    14   ________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Activity Diagrams Activity Diagrams

 Also used in analyzing a use case by 
 Show the conditional logic for the sequence of system 
activities needed to accomplish a business process • Describing what actions need to take place and when they 
should occur; 
 Usually created for one use case and may illustrate 
• Describing a complicated sequential algorithm; and 
several possible scenarios 
• Modeling applications with parallel processes
 Used in conjunction with other modeling techniques, 
such as interaction diagrams and state diagrams 

   
*Property of STI J0069 *Property of STI J0069

15   ________________________    16   ________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Activity Diagrams Activity Diagrams
 Activity Diagram Example
 Symbols used in drawing an activity diagram

*Property of STI J0069
  *Property of STI J0069
 
17   ________________________    18   ________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Interaction Diagrams Interaction Diagrams
• Depict the interactions among objects during a particular 
period of time 
• Can be presented either in a generic form or in an instance   Sequence Diagrams
form 
• Formats are used for labeling messages: 

o The name of the message followed by empty 
parentheses: messageName().
o The name of the message followed by parameters in 
parentheses: messageName(parameter1, parameter2…).

   
*Property of STI J0069 *Property of STI J0069

19   ________________________    20   ________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Interaction Diagrams Interaction Diagrams

 Sequence Diagram Example
• The message name followed by the parameter type, parameter  • Student Admission
name, and any default value for the parameter in parentheses: 
messageName(parameterType:parameterName(defaultValue).  
Parameter types indicate the type of data, such as string, 
number, or date.

• The message may be a stereotype, such as <<Create>>, 
indicating that a new object is created as a result of the message.

*Property of STI J0069
  *Property of STI J0069
 
21   ________________________    22   ________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Interaction Diagrams Interaction Diagrams

 Collaboration Diagram  Collaboration Diagram Example
• Student Admission
• Describe the relationships and interactions among objects in 
the UML 
• Represents the roles, functionality, and behavior of individual 
objects as well as the overall operation of the system in real 
time 
• Suited best on simple interactions among relatively small 
numbers of objects 

   
*Property of STI J0069 *Property of STI J0069

23   ________________________    24   ________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Class Diagrams Class Diagrams

• Classes are arranged in groups that share common characteristics 
• Type of static structure diagram that describes the structure of a 
system by illustrating the system’s classes, their attributes,  • Classes include class name, attributes, and methods
methods, and the relationships between the classes 

• Used to describe the classes of the system and their relationships 
to each other 

*Property of STI J0069
  *Property of STI J0069
 
25   ________________________    26   ________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Class Diagrams Class Diagrams
 Data type (such as integer, string, or float) can be 
included also on a class diagram   Types of Classes
• Entity classes – represent the real‐world items
• Interface classes – provide a means for users to work with 
the system
o Human interface
o System interface
• Abstract classes – cannot be directly instantiated
• Control classes – used to control the flow of activities, and 
act as coordinator when implementing classes
 Methods can be classified into two types:
• Standard
• Custom

   
*Property of STI J0069 *Property of STI J0069

27   ________________________    28   ________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Class Diagrams Class Diagrams
o Zero – represents none 
 Class Diagram Relationships
o A one – represents one and only one
o An asterisk (*) – represents many
• Associations

o Show the relationship between instances of classes 
o Denoted as a simple line on a class diagram 
o End points of the line are labeled with a symbol that indicates 
the multiplicity 

• Used to break up a many‐to‐many association between 
classes 

*Property of STI J0069
  *Property of STI J0069
 
29   ________________________    30   ________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Class Diagrams Class Diagrams
 Association Example
 Whole/Part Relationships

• Described as one class representing the whole object and the 
other class representing the parts 

• Represented as a line with a diamond on one end that 
connects to the classes 

   
*Property of STI J0069 *Property of STI J0069

31   ________________________    32   ________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Class Diagrams Class Diagrams

• A specific College school that contains or includes  Three categories of whole/part relationships:


several Faculty Members
• Aggregation

o Variant of the “has a“ relationship 
o Association that represents a whole/part relationship 
o Represented as a clear diamond shape on the containing class 
end of the line that connects contained class/es to the 
containing class 
o Can occur when a class is a collection or container of other 
classes 

*Property of STI J0069
  *Property of STI J0069
 
33   ________________________    34   ________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Class Diagrams Generalization/Specialization 
(Gen/Spec) Diagrams
• Collection
o Consists of a whole and its members
 Generalization
• Composition • Describes the relationship between a general kind of thing 
o Stronger variant of the “has a” relationship and is more  and a more specific kind of thing 
specific than aggregation  • Also known as inheritance or “is a” relationship 
o Represented as a solid diamond shape on the containing  • Used for modeling class inheritance and specialization 
class end of the line that connects contained class/es to  • Example: an oak is a type of tree 
the containing class 
 Abstract Classes
• General classes and are used when gen/spec is included in 
the design 

   
*Property of STI J0069 *Property of STI J0069

35   ________________________    36   ________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Generalization/Specialization  Statechart Diagrams
(Gen/Spec) Diagrams
 Example of a gen/spec class diagram  • Used to describe the dynamic behavior of a system 
• Describes all the possible states that an object can have as 
events occur 
• Used only for classes where it is required to know the behavior 
of the object through the whole system 
• Created for a single class 
• Objects exist in different states (created, modified, and deleted 
or removed)

*Property of STI J0069
  *Property of STI J0069
 
37   ________________________    38   ________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Statechart Diagrams Statechart Diagrams
 Event
 States
• Occurs at a specific time and place 
• Conditions of an object at a particular time  • Significant occurrence that triggers a state transition
o Changes in the attributes of an object or in the links an object 
• Include a name with each word capitalized 
has with other objects 
• Its name should be unique and pertinent to the users 
• Occurs when a guard condition has been met 
• Has entry and exit actions

   
*Property of STI J0069 *Property of STI J0069

39   ________________________    40   ________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Statechart Diagrams Statechart Diagrams

 Three categories of events:
 Guard Condition
• Something that evaluates to either true or false  • Signals or asynchronous messages – occurs when the calling 
• Can also be a condition that occurs in a method  program does not wait for a message to return, such as a 
• Represented in square brackets next to the event label  feature run from a menu.

 Deferred Events • Synchronous messages – calls to functions or subroutines.  


• Events that are held until an object changes to a state that can  The calling object stops and waits for control to be returned 
accept them  to it, along with an optional message.

• Temporal events – occur at a predetermined time.  These 
usually do not include an actor or any external event.

*Property of STI J0069
  *Property of STI J0069
 
41   ________________________    42   ________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Statechart Diagrams Statechart Diagrams
 Example of statechart diagram diagram  These diagrams are created only when:

• A class has a complex life cycle.
• An instance of a class may update its attributes in a number 
of ways through the life cycle.
• A class has an operational life cycle.
• Two classes depend on each other.
• The object’s current behavior depends on what happened 
previously. 

   
*Property of STI J0069 *Property of STI J0069

43   ________________________    44   ________________________   


 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________     ___________________________   
 ___________________________ ___________________________
Statechart Diagrams

 The two problems that should be avoided in these 
diagrams are:

• Check to see if a state does not have all transitions going into 
the state, or
• All transitions coming out of the state

*Property of STI J0069
 
45   ________________________   
 ___________________________   
 ___________________________   
 ___________________________   
 ___________________________   
 ___________________________   
 ___________________________   
 ___________________________   
 ___________________________
 

You might also like