Use case diagrams in Software Engineering - Time & Space Complexity
When working with use case diagrams, it's helpful to understand how the effort to create or analyze them grows as the system gets bigger.
We want to know how the time needed changes when more actors or use cases are added.
Analyze the time complexity of the following process for creating a use case diagram.
// Pseudocode for creating a use case diagram
for each actor in systemActors:
identify use cases for actor
for each use case:
draw use case
connect actor to use case
end for
end for
This code shows how we add actors and their related use cases to the diagram step by step.
Look at the loops that repeat actions:
- Primary operation: Drawing and connecting each use case for every actor.
- How many times: For each actor, we repeat for all their use cases.
As the number of actors and use cases grows, the work grows too.
| Input Size (actors x use cases) | Approx. Operations |
|---|---|
| 10 actors x 5 use cases | 50 |
| 100 actors x 5 use cases | 500 |
| 100 actors x 50 use cases | 5,000 |
Pattern observation: The total steps increase roughly by multiplying the number of actors by the number of use cases.
Time Complexity: O(a * u)
This means the time needed grows in proportion to the number of actors times the number of use cases.
[X] Wrong: "Adding more actors doesn't affect the time much because use cases stay the same."
[OK] Correct: Each new actor usually has its own use cases or connections, so more actors mean more work overall.
Understanding how the size of a system affects the effort to model it helps you plan and communicate clearly in real projects.
"What if each actor shared the same set of use cases instead of having unique ones? How would the time complexity change?"
Practice
use case diagram in software engineering?Solution
Step 1: Understand the role of use case diagrams
Use case diagrams visually represent how users (actors) interact with the system's functions (use cases).Step 2: Compare with other software tasks
Designing databases, coding, and testing are different activities not shown by use case diagrams.Final Answer:
To show users and their interactions with system functions -> Option DQuick Check:
Use case diagrams = show actors and interactions [OK]
- Confusing use case diagrams with database design
- Thinking use case diagrams show code details
- Assuming use case diagrams test software
actor in a use case diagram?Solution
Step 1: Identify actor symbol in use case diagrams
Actors are represented by stick figures to symbolize users or external systems.Step 2: Recognize other symbols
Ovals represent use cases, rectangles and diamonds are not used for actors.Final Answer:
A stick figure -> Option AQuick Check:
Actor symbol = stick figure [OK]
- Confusing actors with use cases (ovals)
- Choosing rectangles or diamonds for actors
- Not recognizing standard UML symbols
Solution
Step 1: Understand actor-use case connections
Lines between an actor and use cases show the actor can perform those actions.Step 2: Interpret the given connections
Customer connected to "Place Order" and "Track Order" means the customer can do both activities.Final Answer:
Customer can perform both placing and tracking orders -> Option BQuick Check:
Actor connected to use cases = actor performs those actions [OK]
- Thinking actors are system parts
- Assuming use cases depend on each other
- Confusing actors with database entities
Solution
Step 1: Understand <<include>> notation
The <<include>> relationship is shown with a dashed arrow from one use case to another, not from actor to use case.Step 2: Identify the error in arrow style
A solid line from actor to use case shows direct association, not an include relationship, so the diagram is incorrect.Final Answer:
The diagram incorrectly shows a direct association instead of an include relationship -> Option AQuick Check:
Include = dashed arrow between use cases, not solid actor line [OK]
- Drawing solid lines for <<include>>
- Confusing actor symbols with use case symbols
- Misplacing <<include>> arrows from actors
Solution
Step 1: Understand include vs extend relationships
Include means mandatory sub-function; extend means optional or conditional addition.Step 2: Model login/register before dashboard
Since "Dashboard" requires either "Login" or "Register" first, "Dashboard" use case includes both "Login" and "Register" use cases to show mandatory preconditions.Final Answer:
"Dashboard" use case includes both "Login" and "Register" use cases -> Option CQuick Check:
Include = mandatory use case inclusion [OK]
- Using extend instead of include for mandatory steps
- Confusing actors with use cases
- Reversing direction of include/extend arrows
Ready to prove it?
Pass the test and this pattern moves unknown
