Requirements elicitation techniques in Software Engineering - Time & Space Complexity
When gathering requirements, the time it takes to collect and understand user needs can vary greatly.
We want to see how the effort grows as the number of stakeholders or requirements increases.
Analyze the time complexity of this simple requirements gathering process.
def gather_requirements(stakeholders):
requirements = []
for person in stakeholders:
for question in person.questions:
answer = ask(question)
requirements.append(answer)
return requirements
This code collects answers to questions from each stakeholder to build a list of requirements.
Look at the loops that repeat work:
- Primary operation: Asking questions to stakeholders.
- How many times: For each stakeholder, it asks all their questions.
As the number of stakeholders or questions grows, the total questions asked grows too.
| Input Size (stakeholders x questions) | Approx. Operations (questions asked) |
|---|---|
| 10 stakeholders x 5 questions | 50 |
| 100 stakeholders x 5 questions | 500 |
| 1000 stakeholders x 5 questions | 5000 |
Pattern observation: The total work grows directly with the number of questions asked.
Time Complexity: O(n * m)
This means the time grows proportionally to the number of stakeholders times the number of questions per stakeholder.
[X] Wrong: "The time only depends on the number of stakeholders, not questions."
[OK] Correct: Each stakeholder can have many questions, so total time depends on both factors multiplied.
Understanding how effort scales with more users or questions helps you plan and communicate project timelines clearly.
"What if we only asked a fixed number of questions regardless of stakeholders? How would the time complexity change?"