Use Cases: Each Use Case Represents A Set of Scenarios
Use Cases: Each Use Case Represents A Set of Scenarios
Use Cases: Each Use Case Represents A Set of Scenarios
Lending services
Library use-cases
Lending services
Library
User
User administration
Library
Staff
Bookshop: Cataloguer:
Supplier Library Staff
Acquire New
Catalog Item
Dispose
Uncatalog Item
Another Library Use Case Diagram
A computerized library system for a
university keeps track of all books and
periodicals in the library and their check-out EmployeeLogin
status. Checkout and return are automated
through a bar code reader (an external CheckIn
device). The library system also interfaces LibEmployee
with an external relational database which BarCodeReader
stores information about the library users CheckOut
CreateDocument
<<include>> <<include>>
<<include>>
• Problem:
– There are already existing functions. How can we reuse them?
• Solution:
– The include association from Use Case A to Use Case B indicates that
an instance of A performs all the behavior described in B (“A
delegates to B”)
• Example:
– The use case “ViewMap” describes behavior that can be used by the
use case “OpenIncident” (“ViewMap” is factored out)
• Note: The base case cannot exist alone. It is always called with the
supplier use case
<<include>>
OpenIncident
ViewMap
Base Use
Case <<include>>
Supplier
AllocateResources
Use Case
Home Automation example –
factor out common functionality
<<include>>
ToggleHotTub
<<include>> TeaPot
ToggleAppliance
ToggleShades
<<include>>
Shades
ToggleTeaPot
HotTub
User
Another Home Automation example –
factor out common functionality
User
LogFunctions
(from Use Case View)
<<include>>
FeedDogs
DogFeeder
<<Extend>> Association for Use Cases
• Problem:
– The functionality in the original problem statement needs to be
extended.
• Solution:
– An extend association from Use Case B to Use Case A indicates that B
is an extension of A.
• Example:
– The use case “ReportEmergency” is complete by itself , but can be
extended by the use case “Help” for a specific scenario in which the
user requires help
• Note: In an extend association, the base use case can be executed without
the use case extension
Base Use
Case B
Help
FieldOfficer
A <<extend>>
ReportEmergency
Home Automation example
<<extend>>
False Alarm
User
Sound Alarm
Entry Sensor
Generalization association in use cases
• Problem:
– You have common behavior among use cases and want to factor this out.
• Solution:
– The generalization association among use cases factors out common behavior.
The child use cases inherit the behavior and meaning of the parent use case
and add or override some behavior.
• Example:
– Consider the use case “ValidateUser”, responsible for verifying the identity of
the user. The customer might require two realizations: “CheckPassword” and
“CheckFingerprint”
CheckPassword
Parent
ValidateUser
Case Child
CheckFingerprint Use Case
Example using <extend>
BuyOneWayTicket
<<extend>> TransactionAborted
<<extend>>
Traveler BuyWeeklyCard
<<extend>>
<<extend>>
<<extend>>
BuyMonthlyCard
<<extend>>
DistributorOutOfChange
UpdateTariff
CentralCompSys
Simplified with an abstract use case
BuyOneWayTicket
TransactionAborted
<<extend>>
Traveler BuyWeeklyCard
<<extend>>
DistributorException
<<extend>> DistributorOutOfChange
BuyMonthlyCard
UpdateTariff
CentralCompSys