1. 1
CS8592
OBJECT ORIENTED ANALYSIS AND DESIGN
UNIT I - UNIFIED PROCESS AND USE CASE DIAGRAMS
Introduction to OOAD with OO Basics - Unified Process - UML
diagrams - Use Case - Case study- the Next Gen POS system,
Inception - Use case Modelling - Relating Use cases - include,
extend and generalization - When to use Use-cases.
8. 8
What is Object?
âš« An "object" is anything to which a concept applies, in our awareness
âš« Things drawn from the problem domain or solution space.
âš« E.g., a living person in the problem domain, a software component in the solution space.
âš« A structure that has identity and properties and behavior
âš« It is an instance of a collective concept, i.e., a class.
9. 9
Encapsulation
Information hiding
Objects encapsulate:
property
behavior as a collection of methods invoked by
messages
…state as a collection of instance variables
Abstraction
Focus on the essential
Omits tremendous amount of details
…Focus on what an object “is and does”
What is Object-Orientation?
- Abstraction and Encapsulation
10. 10
What is Object-Orientation?
- Another Example of Abstraction and Encapsulation
Class Car
Attributes
âť‘ Model
âť‘ Location
âť‘ #Wheels = 4
Operations
âť‘ Start
âť‘ Accelerate
<<instanceOf>>
<<instanceOf>>
<<instanceOf>>
11. 11
What is Object-Orientation?
- Class
âš« What is CLASS?
âš« a collection of objects that share common properties, attributes, behavior and
semantics, in general.
âš« A collection of objects with the same data structure (attributes, state variables)
and behavior (function/code/operations) in the solution space.
âš« Classification
âš« Grouping of common objects into a class
âš« Instantiation.
âš« The act of creating an instance.
Class Car
Attributes
âť‘ Model
âť‘ Location
âť‘ #Wheels = 4
Operations
âť‘ Start
âť‘ Accelerate
<<instanceOf>>
<<instanceOf>>
<<instanceOf>>
12. 12
What is Object-Orientation?
- Subclass vs. Superclass
• Specialization: The act of defining one class as a refinement of another.
• Subclass: A class defined in terms of a specialization of a superclass
using inheritance.
• Superclass: A class serving as a base for inheritance in a class hierarchy
• Inheritance: Automatic duplication of superclass attribute and behavior
definitions in subclass.
Person
name
SSN
Student
std-id
level
Employee
emp-id
age
13. 13
What is Object-Orientation?
- Polymorphism
Objects of different classes respond to the same message differently.
payTuition
Person
name
SSN
Student
std-id
level
Employee
emp-id
In-State
Student
state
payTuition payTuition
Out-of-State
Student
payTuition
14. 14
What is Object-Orientation?
- Interfaces
• Information hiding - all data should be hidden within a class, at least in principle.
• make all data attributes private
• provide public methods to get and set the data values (cf. Java design patterns)
• e.g. Grade information is usually confidential, hence it should be kept
private to the student. Access to the grade information should be
done through interfaces, such as setGrade and getGrade
payTuition
setGrade()
getGrade()
Student
std-id
level
getGrade
setGrade
grade
15. 15
What is Object-Orientation?
-State transition impossible?
tom: Actor
name = “Tom Cruise”
katie: Actor
name = “Katie Holmes”
tom: Actor
name = “Tom Holmes”
katie: Actor
name = “Katie Holmes”
married/changeLastName
tom: Actor
name = “Tom Holmes”
katie: Actor
name = “Katie Holmes”
suri: BabyActor
name = “Suri Holmes”
newArrival/getName
17. 17
What is OOAD?
⚫ Analysis — understanding, finding and describing concepts in
the problem domain.
⚫ Design — understanding and defining software solution/objects
that represent the analysis concepts and will eventually be
implemented in code.
⚫ OOAD — Analysis is object-oriented and design is object-
oriented. A software development approach that emphasizes a
logical solution based on objects.
19. 19
Introduction to OOAD
OO Prog. Languages
(Smalltalk, C++)
just program!
OO Design
(Booch) design then
program
OO Analysis
(Rumbaugh, Jacobson)
Process Perspective
OO Technology
Analyze (use case) first,
then design,
T then program
20. 20
Knowledge
Representation (in A.I.)
Psychological Validity
Philosophical Validity
Computational Validity
Databases
Emphasis in Persistent Data
(and now ACID properties)
RelationalDB
Network DB
Hierarchical DB
OODB
Programming Languages
Emphasis in Efficiency
Simula, SmallTalk, C++, Protel,
Java
ERD
SDM
CM
ADT
ERD: Entity Relationship Diagram
SDM: Semantic Data Model
ADT: Abstract Data Type
CM: Conceptual Model
Why Object-Oriented
- Who’s Behind Object-Orientation
System/Software
Engineering
21. Unified Process
âš« It emphasizes the difference between
engineering and production.
âš« The Unified Process is not simply a
process, but rather an extensible
framework which should be
customized for specific organizations
or projects.
22. Difference: Engineering vs. Production
âš« Engineering Stage
âš« Driven by less predictable but smaller teams, focusing
on design and synthesis activities
âš« Production Stage
âš« Driven by more predictable but larger teams, focusing
on construction, test and deployment activities
23. Phases in the Unified Process
âš« The two stages of the Unified Process
are decomposed into four distinct phases
âš« Engineering stage
1. Inception phase
2. Elaboration phase
âš« Production phase
3. Construction phase
4. Transition phase
25. Inception Phase
âš« Investigation
âš« Establish the project scope
âš« Identify the critical use cases and
scenarios
âš« Define acceptance criteria
âš« Demonstrate at least one candidate
software architecture
âš« Estimate the cost and schedule for the
project
âš« Define and estimate potential risks
26. Elaboration Phase
âš« Baseline the software architecture
âš« Establish a configuration management plan
in which all changes are tracked and
maintained
âš« Baseline the problem statement
âš« Baseline the software project
management plan for the construction
phase
âš« Demonstrate that the architecture
supports the requirements at a
reasonable cost in a reasonable time
27. Construction Phase
âš« Minimize development costs by
optimizing resources
âš« Achieve adequate quality as rapidly as
practical
âš« Achieve useful version (alpha, beta, and
other test releases) as soon as possible
28. Transition Phase
âš« The transition phase is entered when a
baseline is mature
âš« A usable subset of the system has been built with
acceptable quality levels and user documents
âš« It can be deployed to the user community
âš« For some projects the transition phase means
the starting point for another version of the
software system
âš« For other projects the transition phase means
the complete delivery of the software system to
a third party responsible for operation,
maintenance and enhancement.
29. Profile of a typical project showing the
relative sizes of the four phases of the
Unified Process.
Relative sizes of the four phases
30. Diagram illustrating how the relative emphasis of different
disciplines changes over the course of the project
Relative emphasis of different disciplines changes
31. What is UML?
âš« UUML - Unified Modeling language
âš« UML is a modeling language, not a methodology or process
âš« Developed by Grady Booch, James Rumbaugh and Ivar
Jacobson at Rational Software.
The Unified Modelling Language (UML) is a language for
specifying, visualizing, constructing, and documenting the
artefacts of software systems, as well as for business
modelling and other non-software systems.
33. Structural
: element of spec. irrespective of time
• Class
• Component
• Deployment
• Object
• Composite structure
• Package
Behavioral
: behavioral features of a system / business
process
• Activity
• State machine
• Use case
Interaction
: emphasize object interaction
• Communication(collaber
ation)
• Sequence
• Interaction overview
• Timing
UML Diagrams
34. 34
Use cases diagram
âš« Capture the specific ways of using the
system as dialogues between an actor
and the system.
âš« Use cases are used to
âš« Capture system requirements
âš« Communicate with end users and Subject
Matter Experts
âš« Test the system
Use cases diagrams describes the behavior of the target
system from an external point of view. Use cases
describe "the meat" of the actual requirements.
35. 35
Naming Use Cases
âš« Must be a complete process from the
viewpoint of the end user
âš« Usually in verb-object form, like Buy
Pizza
âš« Use enough detail to make it specific
âš« Use active voice, not passive
âš« From viewpoint of the actor, not the
system
36. 36
Use Case Name Examples
âš« Excellent - Purchase Concert Ticket
âš« Very Good - Purchase Concert Tickets
âš« Good - Purchase Ticket (insufficient detail)
âš« Fair - Ticket Purchase (passive)
âš« Poor - Ticket Order (system view, not user)
âš« Unacceptable - Pay for Ticket (procedure,
not process)
37. 37
CRUD
âš« Examples of bad use case names with
the acronym CRUD. (All are procedural
and reveal nothing about the actor’s
intentions.)
âš« C - actor Creates data
âš« R - actor Retrieves data
âš« U - actor Updates data
âš« D - actor Deletes data
38. 38
Actor
âš« An actor is an idealized
user of a system
âš« Actors can be users,
processes, and other
systems
âš« Many users can be one
actor, in a common role
âš« One user can be different
actors, based on different
roles
âš« An actor is labeled with
the name of the role
39. 39
Identify Actors
âš« We cannot understand a system until we
know who will use it
âš« Direct users
âš« Users responsible to operate and maintain it
âš« External systems used by the system
âš« External systems that interact with the
system
40. 40
Non-human Actor
âš« Actors can be users,
processes, and other
systems.
âš« Show non human actors
in a different manner,
usually as a rectangle
âš« Non human actors are
usually not primary users,
and thus are usually
shown on the right, not
the left.
Inventory
System
41. 41
Types of Actors
âš« Primary Actor
âš« Has goals to be fulfilled by system
âš« Supporting Actor
âš« Provides service to the system
âš« Offstage Actor
âš« Interested in the behavior, but no
contribution
âš« In diagrams, Primary actors go on the left and
others on the right.
42. 42
Define Actors
âš« Actors should not be analyzed or described in
detail unless the application domain demands
it.
âš« Template for definition:
âš« Name
âš« Definition
âš« Example for an ATM application:
Customer: Owner of an account who manages
account by depositing and withdrawing funds
43. 43
Overview
âš« A use case
diagram
identifies
transactions
between
actors and a
system as
individual use
cases
44. 44
Use Case
âš« A use case is a coherent unit
of externally visible
functionality provided by a
system and expressed by a
sequence of messages
âš« Additional behavior can be
shown with parent-child,
extend and include use
cases
âš« It is labeled with a name that
the user can understand
45. 45
System
âš« A system is shown as a
rectangle, labeled with
the system name
âš« Actors are outside the
system
âš« Use cases are inside the
system
âš« The rectangle shows the
scope or boundary of the
system
46. 46
Association Relationship
âš« An association is the
communication path between
an actor and the use case that
it participates in
âš« It is shown as a solid line
âš« It does not have an arrow, and
is normally read from left to
right
âš« Here, the association is
between a Modeler and the
Create Model use case
47. 47
Relationships in Use Cases
There are several Use Case relationships:
âš« Association
âš« Extend
âš« Generalization
âš« Uses
âš« Include
Most Use Cases have only associations.
Use other relationships sparingly.
48. 48
Extend Relationship
âš« Extend puts additional
behavior in a use case
that does not know
about it.
âš« It is shown as a dotted
line with an arrow point
and labeled <<extend>>
âš« In this case, a customer
can request a catalog
when placing an order
49. 49
Use Case Generalization
âš« Generalization is a
relationship between a
general use case and a
more specific use case
that inherits and extends
features to it
âš« It is shown as a solid line
with a closed arrow point
âš« Here, the payment
process is modified for
cash and charge cards
50. 50
Uses Relationship
âš« When a use case uses
another process, the
relationship can be
shown with the uses
relationship
âš« This is shown as a solid
line with a closed arrow
point and the <<uses>>
keyword
âš« Here different system
processes can use the
logon use case
51. 51
Include Relationship
âš« Include relationships
insert additional behavior
into a base use case
âš« They are shown as a
dotted line with an open
arrow and the key word
<<include>>
âš« Shown is a process that
I observed in an earlier
career
52. 52
Use Case Example: Alarm Clock
This is a contrived
example, to show
many relations.
Your diagrams
should be simpler.
53. Class Diagrams
âš« A Class is a Description of Set of Objects
that Share the Same Attributes,
Operations, Methods, Relationships, and
Semantics
âš« Classes are Graphically Represented as
Boxes with Compartments for
âš« Class Name, Private Attributes, and
Public Operations
54. Class Diagram (Rumbaugh/Booch)
âš« Class Diagram Describes
– Types of Objects in Application
– Static Relationships Among Objects
– Temporal Information Not Supported
âš« Class Diagrams Contain
– Classes: Objects, Attributes, and Operations
– Packages: Groupings of Classes
– Subsystems: Grouping of Classes/Packages
âš« Main Concepts: Class, Association,
Generalization, Dependency, Realization,
Interface
55. Classes
A class represent a concept
A class encapsulates state (attributes) and
behavior (operations).
Each attribute has a type.
Each operation has a signature.
The class name is the only mandatory information.
zone2price
getZones()
getPrice()
TariffSchedule
Table zone2price
Enumeration getZones()
Price getPrice(Zone)
TariffSchedule
Name
Attributes
Operations
Signature
TariffSchedule
56. UML Class Notation
A class is a rectangle divided into three parts
– Class name
– Class attributes (i.e. data members, variables)
– Class operations (i.e. methods)
Modifiers
– Private: -
– Public: +
– Protected: #
– Static: Underlined (i.e. shared among all members of the class)
Abstract class: Name in italics
+getName() : string
+setName()
-calcInternalStuff(in x : byte, in y : decimal)
-Name : string
+ID : long
#Salary : double
Employee
• An abstract class has one or more
abstract/pure virtual functions.
• An abstract class cannot be used to instantiate
objects.
• An abstract class can contain data members.
57. UML Class Notation
Lines or arrows between classes indicate relationships
– Association
• A relationship between instances of two classes, where one class
must know about the other to do its work, e.g. client communicates to
server
• indicated by a straight line or arrow
– Aggregation
• An association where one class belongs to a collection, e.g. instructor
part of Faculty
• Indicated by an empty diamond on the side of the collection
– Composition
• Strong form of Aggregation
• Lifetime control; components cannot exist without the aggregate
• Indicated by a solid diamond on the side of the collection
– Inheritance
• An inheritance link indicating one class a superclass relationship, e.g.
bird is part of mammal
• Indicated by triangle pointing to superclass
59. Unary Association
A knows about B, but B knows nothing about A
Arrow points in direction
of the dependency
myB.service();
60. Aggregation
Aggregation is an association with a “collection-member” relationship
void doSomething()
aModule.service();
Hollow diamond on
the Collection side
61. Composition
+getName() : string
+setName()
-calcInternalStuff(in x : byte, in y : decimal)
-Name : string
+ID : long
#Salary : double
-adfaf : bool
Employee
-members : Employee
Team
1
*
Composition is Aggregation with:
Lifetime Control (owner controls construction, destruction)
Part object may belong to only one whole object
Filled diamond on
side of the Collection
members[0] =
new Employee();
…
delete members[0];
64. UML Multiplicities
Multiplicities Meaning
0..1
zero or one instance. The notation n . . M
indicates n to m instances.
0..* or *
no limit on the number of instances
(including none).
1 exactly one instance
1..* at least one instance
Links on associations to specify more details about the relationship
68. Sequence Diagram
âš« Sequence Diagram: For a Task, Indicates
the Object Interactions Over Time that are
Needed
âš« Captures Dynamic Behavior (Time-
oriented)
âš« Purposes:
âš« Model Flow Of Control
âš« Illustrate Typical Scenarios
âš« Provide Perspective on Usage an Flow
âš« Main Concepts: Interaction, Object,
Message, Activation
72. Collaboration Diagram
âš« Collaboration Diagram: Structured from the
Perspective of Interactions Among Objects
âš« Captures Dynamic Behavior (Message-
oriented)
âš« Purposes:
âš« Model Flow of Control
âš« Illustrate Coordination of Object Structure
and Control
âš« Objects that Interact with Other Objects
75. State chart Diagrams
initial State
state
transition
event
A State chart diagram shows the lifecycle of an object
• A state is a condition of an object for a particular time
• An event causes a transition from one state to another state
Here is a State chart for a Phone Line object:
76. State charts in UML: States in ovals, Transitions as arrows
Transitions labels have three
optional parts:
Event [Guard] / Action
– Find one of each
– Item Received is an event,
/get first item is an action,
[Not all items checked] is a
guard
State may also label activities,
e.g., do/check item
– Actions, associated with
transitions, occur quickly
and aren’t interruptible
– Activities, associated with
states, can take longer and
are interruptible
– Definition of “quickly” depends
on the kind of system,
e.g., real-time vs. info system
77. When to develop a state chart?
• Devices (microwave oven, Ipod)
• Complex user interfaces (e.g., menus)
• Transactions (databases, banks, etc.)
• Stateful sessions (server-side objects)
• Controllers for other objects, Etc.
78. Superstates (nested states)
Example shows a
super-state of three
states
Can draw a single
transition to and
from a super-state
How does this
notation make
things a bit
clearer?
79. Concurrency in state diagrams
– Dashed line indicates that an order is in two
different states, e.g. Checking & Authorizing
– When order leaves concurrent states, it’s in a
single state: Canceled, Delivered or Rejected
81. 81
Activity Diagram
âš« Two definitions
– an activity is some task that needs to be done,
whether by a human or a computer
– an activity is a method on a class
âš« Activity arrangement
– Sequential – one activity is followed by
another
– Parallel – two or more sets of activities are
performed concurrently, and order is irrelevant
• Interleaving is permitted – we can jump
between the parallel flows
82. 82
What is an Activity?
âš« Activity Diagrams are used to describe activities
– Activity Diagrams are useful for describing
complicated methods
– Activity Diagrams are useful for describing use
cases & since.
âš« Activity Diagrams are like Flow Charts, but Flow
Charts are usually limited to sequential activities while
Activity Diagrams can show parallel activities as well
83. 83
Activity Diagrams - Notation
âš«Start at the top black circle
âš«If condition 1 is TRUE, go right;
if condition 2 is TRUE, go down
âš«At first bar (a synchronization
bar), break apart to follow 2
parallel paths
âš«At second bar, come together to
proceed only when both parallel
activities are done
Notation
87. UML Deployment Diagram
Deployment diagrams are used to visualize the
topology of the physical components of a system
where the software components are deployed.
Deployment diagrams consist of nodes and their
relationships.
Component diagrams and deployment diagrams
are closely related.
Component diagrams are used to describe the
components and deployment diagrams shows how
they are deployed in hardware.
88. Purpose of Deployment Diagrams
âš« Visualize hardware topology of a system.
âš« Describe the hardware components used
to deploy software components.
âš« Describe runtime processing nodes.
89. Where to use Deployment Diagrams?
âš« Deployment diagrams are mainly used by
system engineers.
âš« These diagrams are used to describe the
physical components (hardwares), their
distribution and association.
90. Usage of deployment diagrams
âš« To model the hardware topology of a system.
âš« To model embedded system.
âš« To model hardware details for a client/server
system.
âš« To model hardware details of a distributed
application.
âš« Forward and reverse engineering.
92. Communication Path
Communication path is an association
between two deployment targets.
Communication path between several application
servers and database server
93. Deployment Specification
A deployment specification can be aimed at a
specific type of container for a components.
The ejb-jar.xml deployment
specification
94. Deployment Specification Dependency
A deployment specification could be displayed as a
classifier rectangle attached to a component
artifact using a regular dependency arrow pointing
to deployed artifact.
ejb-jar.xml deployment specification for user-
service.ejb artifact
97. UML Package Diagrams
UML Package Diagrams:
– Used to illustrate the logical architecture of
a system
• Layers, subsystems, Java packages
– Provides a way to group elements
• Different from (more general than) a Java
package
• Can group anything
– Classes, other packages, diagrams, use cases, …
• Nesting packages is very common
98. 98
Package Diagrams
Package – contains classes
Dependency – changes to the
definition (interface) of one
package may cause changes in
the other package
101. UML Component Diagram
âš«Component diagrams can also be described as a static
implementation view of a system.
âš«Static implementation represents the organization of the
components at a particular moment.
âš«Component diagrams are used to model physical
aspects of a system.
âš«Used to visualize the organization and relationships
among components in a system.
âš«These diagrams are also used to make executable
systems.
102. Purpose of the component diagram
âš« Visualize the components of a system.
âš« Construct executables by using forward and
reverse engineering.
âš« Describe the organization and relationships of
the components.
103. How to draw Component Diagram?
Before drawing a component diagram the following artifacts
are to be identified clearly:
– Files used in the system.
– Libraries and other artifacts relevant to the application.
– Relationships among the artifacts.
After identifying the artifacts the following points needs to be
followed:
– Use a meaningful name to identify the component for which the
diagram is to be drawn.
– Prepare a mental layout before producing using tools.
– Use notes for clarifying important points.
104. Where to use Component Diagrams?
âš« Model the components of a system.
âš« Model database schema.
âš« Model executables of an application.
âš« Model system's source code.
107. The Case Study
âš« The text uses the development of a
Point of Sale (POS) System as a case
study to demonstrate object oriented
software development.
âš« A POS system is a replacement for a
cash register that adds many
computer services to the traditional
cash register. Most retail stores now
use POS systems.
108. Architectural Layers
âš« User Interface
âš« Application Logic and Domain Objects
âš« Sale and Payment
âš« Technical Services
âš« Log and Persistence
109. Case Study : POS System
âš« A computerized NextGen point-of-sale (POS) system is to:
âš« record sales, and
âš« handle payments.
âš« It includes H/S components such as:
âš« Computer
âš« Bar code scanner
âš« Software
âš« It interfaces to various service applications, such as:
âš« Third party tax calculators
âš« Inventory control
âš« It must support multiple and varied client-side terminals and interfaces, such as:
âš« A thin Web browser terminal
âš« A regular PC with Java Swing graphical UI
âš« Touch screen input
⚫ Wireless PDA’s
âš« It should support different clients with different business rules.
110. Inception
âš« Purpose is to decide whether to
proceed with development, not to
define requirements.
âš« Only key requirements are investigated.
112. Questions during inception
âš« What is the vision for this project?
âš« What is the business case?
âš« Is the project feasible?
âš« Should we buy or build?
âš« Rough estimate of cost?
âš« At end of inception: Go or No Go?
113. Problem statement
âš« Do the stakeholders have basic
agreement on the vision of the project,
and is it worth investing in serious
investigation?
114. Vision and Business Case
âš« Describes the high level goals and
constraints, the business case, and
provides an executive summary.
âš« Usually has an estimate of costs (+/-
100%) and expected benefits stated in
financial terms.
115. Use Case Model
âš« Describes the functional requirements
and related non-functional
requirements.
âš« Preliminary only, usually the names of
most of the expected use cases and
actors, but usually only about 10% of
the use cases are detailed.
âš« Do not confuse a use case diagram
with a use case. It is mostly text.
116. Use Cases and Actors
âš« You should have identified most of the
use cases and actors during inception.
âš« Do not detail all of the use cases. Only
document the most important ones.
About 10 or 20% of the use cases
should be detailed enough to estimate
the scope of the total project.
117. Use Case Relationships
Domain Model
Use Case Model
Interaction Diagrams
Design
Requirements
Business Model
Objects, attributes, associations
VISION
GLOSSARY
SUPPLEMENTARY
SPECIFICATION
118. Use Cases are not Diagrams
âš« Use Cases may have a diagram associated
with them, and a use case diagram is an
easy way for an analyst to discuss a
process with a subject matter expert (SME).
âš« But use cases are primarily text. The text is
important. The diagram is optional.
119. Why Use Cases?
âš« Simple and familiar story-telling makes
it easier, especially for customers, to
contribute and review goals.
âš« Use cases keep it simple
âš« They emphasize goals and the user
perspective.
âš« New use case writers tend to take them
too seriously.
120. Actors or Use Case First?
âš« The text describes use cases substantially
before paying attention to actors.
âš« Typically, both actors and use cases are
identified early and then examined to see if
more use cases can be found from the actors,
or more actors found by examining the use
cases.
121. How Use Cases look like?
âš« Capture the specific ways of using the
system as dialogues between an actor
and the system.
âš« Use cases are used to
âš« Capture system requirements
âš« Communicate with end users and Subject
Matter Experts
âš« Test the system
122. USE CASE : Process Sale
(FULLY DRESSED VERSION)
âš« Primary Actor: Cashier
âš« Stakeholders and Interests:
Cashier: Wants accurate and fast entry, no
payment errors, …
Salesperson: Wants sales commissions
updated. …
âš« Preconditions: Cashier is identified and authenticated.
âš« Success Guarantee (Post conditions):
Sale is saved. Tax correctly calculated.…
âš« Main success scenario (or basic flow)
âš« Extensions (or alternative flows)
⚫ Special requirements: Touch screen UI, …
123. Use case (contd…)
âš« Technology and Data Variations List:
Identifier entered by bar code scanner,…
⚫ Open issues: What are the tax law variations? …
âš« Main success scenario (or basic flow):
The Customer arrives at a POS checkout with
items to purchase.
The cashier records the identifier for each item. If
there is more than one of the same item, the
Cashier can enter the quantity as well.
The system determines the item price and adds
the item information to the running sales
transaction. The description and the price of the
current item are presented.
124. Use case (contd…)
On completion of item entry, the Cashier
indicates to the POS system that item entry
is complete.
The System calculates and presents the sale
total.
The Cashier tells the customer the total. The
Customer gives a cash payment (“cash
tendered”) possibly greater than the sale
total.
âš« Extensions (or alternative flows):
If invalid identifier entered. Indicate error.
If customer didn’t have enough cash, cancel
125. Things that are in Use Cases
âš« Create a written document for each Use Case
âš« Clearly define intent of the Use Case
âš« Define Main Success Scenario (Happy
Path)
âš« Define any alternate action paths
âš« Use format of Stimulus: Response
âš« Each specification must be testable
⚫ Write from actor’s perspective, in actor’s
vocabulary
126. Use cases Template
âš« Name
âš« Primary Actor
âš« Scope
âš« Level
âš« Stakeholders and Interests
âš« Minimal Guarantee
âš« Success Guarantee
âš« Main Success Scenario
âš« Extensions
127. Naming Use Cases
âš« Must be a complete process from the
viewpoint of the end user.
âš« Usually in verb-object form, like Buy
Pizza
âš« Use enough detail to make it specific
âš« Use active voice, not passive
âš« From viewpoint of the actor, not the
system
128. Golden Rule of Use-Case Names
âš« Each use case should have a name that
indicates what value (or goal) is achieved
by the actor's interaction with the system
âš« Here are some good questions to help
you adhere to this rule:
âš« Why would the actor initiate this interaction with
the system?
âš« What goal does the actor have in mind when
undertaking these actions?
âš« What value is achieved and for which actor?
129. Use Case Name Examples
âš« Excellent - Purchase Concert Ticket
âš« Very Good - Purchase Concert Tickets
âš« Good - Purchase Ticket (insufficient detail)
âš« Fair - Ticket Purchase (passive)
âš« Poor - Ticket Order (system view, not user)
âš« Unacceptable - Pay for Ticket (procedure,
not process)
130. CRUD
Examples of bad use case names with the
acronym CRUD. (All are procedural and
reveal nothing about the actor’s intentions.)
âš« C - actor Creates data
âš« R - actor Retrieves data
âš« U - actor Updates data
âš« D - actor Deletes data
131. Identify Actors
âš« We cannot understand a system until we
know who will use it
âš« Direct users
âš« Users responsible to operate and maintain it
âš« External systems used by the system
âš« External systems that interact with the
system
132. Types of Actors
âš« Primary Actor
âš« Has goals to be fulfilled by system
âš« Supporting Actor
âš« Provides service to the system
âš« Offstage Actor
âš« Interested in the behavior, but no
contribution
In diagrams, Primary actors go on the
left and others on the right.
133. Define Actors
âš« Actors should not be analyzed or
described in detail unless the application
domain demands it.
âš« Template for definition:
âš« Name
âš« Definition
âš« Example for an ATM application:
Customer: Owner of an account who
manages account by depositing and
withdrawing funds
134. Working with Use Cases
âš« Determine the actors that will interact with the
system
âš« Examine the actors and document their
needs
âš« For each separate need, create a use case
âš« During Analysis, extend use cases with
interaction diagrams
135. Preconditions
âš« Anything that must always be true before
beginning a scenario is a precondition.
âš« Preconditions are assumed to be true, not
tested within the Use Case itself.
âš« Ignore obvious preconditions such as the
power being turned on. Only document items
necessary to understand the Use Case.
136. Success Guarantees
âš« Success Guarantees (or Post conditions)
state what must be true if the Use Case is
completed successfully. This may include
the main success scenario and some
alternative paths.
âš« Example, if the happy path is a cash sale, a
credit sale might also be regarded a
success.
âš« Stakeholders should agree on the
guarantee.
137. Scenarios
⚫ The Main Success Scenario, or “happy
path” is the expected primary use of the
system, without problems or exceptions.
âš« Alternative Scenarios or Extensions are
used to document other common paths
through the system and error handling or
exceptions.
138. Documenting the Happy Path
âš« The Success Scenario (or basic course) gives the best
understanding of the use case
âš« Each step contains the activities and inputs of the actor and the
system response
âš« If there are three or more items, create a list
âš« Label steps for configuration management and requirements
traceability
âš« Use present tense and active voice
âš« Remember that User Interface designers will use this
specification
Note: Do not use the term “happy path” in formal documents.
139. Documenting Extensions
âš« Use same format as Happy Path
âš« Document actions that vary from ideal path
âš« Include error conditions
âš« Number each alternate, and start with the condition:
Condition: If [actor] performs [action] the system …
âš« If subsequent steps are the same as the happy
path, identify and label as (same)
âš« Steps not included in alternate course are assumed
not to be performed.
140. Two Parts for Extensions
âš« Condition
âš« Describe the reason for the alternative flow
as a condition that the user can detect
âš« Handling
âš« Describe the flow of processing in the
same manner as the happy path, using a
numbering system consistent with the
original section.
141. Types of Use Cases
âš« High Level Use Case (Brief)
âš« Name, Actors, Purpose, Overview
âš« Expanded Use Case (Fully Dressed)
âš« Add System Events and System
Responses
âš« Essential Use Case (Black Box)
âš« Leave out technological implications
âš« Real Use Case (White Box)
âš« Leave in technology
142. Overview
âš« A use case
diagram
identifies
transactions
between
actors and a
system as
individual use
cases
143. Actor
âš« An actor is an idealized user
of a system
âš« Actors can be users,
processes, and other
systems
âš« Many users can be one
actor, in a common role
âš« One user can be different
actors, based on different
roles
âš« An actor is labeled with the
name of the role
144. Non-human Actor
âš« Actors can be users,
processes, and other
systems.
âš« Show non human actors
in a different manner,
usually as a rectangle
âš« Non human actors are
usually not primary users,
and thus are usually
shown on the right, not
the left.
Inventory
System
145. Use Case
âš« A use case is a coherent unit
of externally visible
functionality provided by a
system and expressed by a
sequence of messages
âš« Additional behavior can be
shown with parent-child,
extend and include use
cases
âš« It is labeled with a name that
the user can understand
146. System
âš« A system is shown as a
rectangle, labeled with
the system name
âš« Actors are outside the
system
âš« Use cases are inside the
system
âš« The rectangle shows the
scope or boundary of the
system
147. Association Relationship
âš« An association is the
communication path between
an actor and the use case that
it participates in
âš« It is shown as a solid line
âš« It does not have an arrow, and
is normally read from left to
right
âš« Here, the association is
between a Modeler and the
Create Model use case
148. Relationships in Use Cases
âš« There are several Use Case relationships:
âš« Association
âš« Extend
âš« Generalization
âš« Uses
âš« Include
Most Use Cases have only
associations. Use other
relationships sparingly.
149. Extend Relationship
âš« Extend puts additional
behavior in a use case that
does not know about it.
âš« It is shown as a dotted line
with an arrow point and
labeled <<extend>>
âš« In this case, a customer can
request a catalog when
placing an order
150. Use Case Generalization
âš« Generalization is a
relationship between a
general use case and a
more specific use case
that inherits and extends
features to it
âš« It is shown as a solid line
with a closed arrow point
âš« Here, the payment
process is modified for
cash and charge cards
151. Uses Relationship
âš« When a use case uses
another process, the
relationship can be
shown with the uses
relationship
âš« This is shown as a solid
line with a closed arrow
point and the <<uses>>
keyword
âš« Here different system
processes can use the
logon use case
152. Include Relationship
âš« Include relationships
insert additional behavior
into a base use case
âš« They are shown as a
dotted line with an open
arrow and the key word
<<include>>
âš« Shown is a process that
I observed in an earlier
career
153. Use Case Example: Alarm Clock
This is a contrived
example, to show
many relations.
Your diagrams
should be simpler.
154. Ref: Text Book-1
Craig Larman, Applying UML and Patterns: An Introduction to Object Oriented Analysis and
Design and Iterative Development, Third Edition, Pearson Education, 2005.