Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

usecase

Use case diagrams visualize interactions between user groups and systems.
They show which actions can be performed by whom in a system.

Application Area

By describing which actions need to be performed by whom, they model the requirements users have towards systems.

Specification

Elements

All Elements have a unique identifier.
This ID may not repeat across any boundaries or types.

Actors

Actors represent user groups or roles that interact with the system.

Note

They are not individual people, but categories of users which perform actions.

-John needs to be able to save his work.
+Developers need to save their work.

Actors are defined by their ID and display name.

@<ID>:"<Display Name>"

Note

The @ is inspired by modern username handles.

Between the : and the start of the display name, an arbitrary amount of spaces is allowed.
This allows for aligning the diagram code, so that it is easier to read.

-@customer:"Customer"
-@premium:"Premium Customer"
-@admin:"Administrator"

+@customer:"Customer"
+@premium: "Premium Customer"
+@admin:   "Administrator"

Systems

Systems represent the boundaries within which use cases occur.
They are defined using square brackets and their display name.
The closing bracket has to be on another line, as they are containers for use cases.

["<Display Name>":
    ...
]

Note

The [] are inspired by the UML standard, where systems are bounds, marked by rectangles.

Systems can“t be nested.

Use Cases

Use cases define the actions that actors can perform within a system.
They must be inside a system. They are defined using parentheses, their ID, and a display name.

(<ID>:"<Display Name>")

Note

The () are inspired by the UML standard, where use cases are denoted by ellipses.

Use cases must be indented inside their system.

["My System":
-(submit:"Submit Data")
]

["My System":
+	(submit:"Submit Data")
]

Relations

Generalization

Extend

Include

Use

Full Example

# actors
@customer:"Customer"
@premium: "Premium Customer"
@admin:   "Administrator"
@sale:    "Salesman"
@manager: "Sales Manager"

# inherit/generalize
premium+=customer
manager+=sale

# system
["E-Commerce Platform":
	# cases
	(browse:  "Browse Products")
	(search:  "Search Products")
	(order:   "Place Order")
	(pay:     "Process Payment")
	(track:   "Track Shipment")
	(review:  "Write Review")
	(inv:     "Manage Inventory")
	(reports: "Generate Reports")
	(discount:"Apply Discount")
]

# extend
order..>pay
order..>track

# include
order->discount
browse->search

["CRM System":
	(manage_customer:"Manage Customers")
	(view_history:   "View Purchase History")
]

# extend across systems
view_history..>pay

# use
customer->browse & order & track & review
premium->discount
admin->inv & manage_customers
sale->reports & view_history
# actors
@customer:"Customer"
@premium: "Premium Customer"
@admin:   "Administrator"
@sale:    "Salesman"
@manager: "Sales Manager"

# inherit/generalize
premium+=customer
manager+=sale

# system
["E-Commerce Platform":
	# cases
	(browse:  "Browse Products")
	(search:  "Search Products")
	(order:   "Place Order")
	(pay:     "Process Payment")
	(track:   "Track Shipment")
	(review:  "Write Review")
	(inv:     "Manage Inventory")
	(reports: "Generate Reports")
	(discount:"Apply Discount")
]

# extend
order..>pay
order..>track

# include
order->discount
browse->search

["CRM System":
	(manage_customer:"Manage Customers")
	(view_history:   "View Purchase History")
]

# extend across systems
view_history..>pay

# use
customer->browse & order & track & review
premium->discount
admin->inv & manage_customers
sale->reports & view_history