Chapter 13 of 32

Requirements Engineering

Studies of failed software projects keep finding the same root cause: not bad code, but building the wrong thing. The client wanted one feature and the team built another; an important rule was never written down; two departments expected contradictory behaviour; a "fast" system turned out to mean something different to everyone. A bug in the requirements is also the most expensive kind of bug, because by the time it is discovered, design, code and tests have all been built on top of it.

Every life cycle model we have seen, from the Waterfall Model to Scrum, has to answer the same question first: what exactly should the system do? The discipline that answers it is requirements engineering.

A requirement is a statement of a service a system must provide, or a constraint under which it must operate, in order to satisfy a stakeholder's need.

Requirements Engineering (RE) is the systematic process of discovering, analysing, documenting, validating and managing the requirements of a system throughout its life.

The word engineering matters: requirements are not just "collected" like shopping items. They are discovered, negotiated, checked and tracked with the same discipline as code.


Stakeholders

A stakeholder is anyone who affects or is affected by the system. Missing a stakeholder means missing their requirements.

For an online canteen ordering app for a college, stakeholders include:

  • Students and staff who order food (end users).

  • Canteen manager and kitchen staff who receive and prepare orders.

  • College administration, who pays for the system and sets policy.

  • Accounts department, who reconciles payments.

  • Payment gateway provider and regulators (data protection, payment rules).

  • The development and support team, who must build and maintain it.


Types of Requirements

User requirements vs system requirements

User requirementsSystem requirements
Written for customers and users, in natural language and simple diagramsWritten for developers and testers, detailed and precise
Say what services are needed at a high levelSay exactly what the system shall do, with inputs, outputs, rules and limits
Example: "Students should be able to order food online."Example: "The system shall allow a logged-in student to place an order containing 1 to 10 items from the menu items marked available."

Functional vs non-functional requirements

Functional requirements describe what the system should do: the services it provides, how it reacts to particular inputs, and how it behaves in particular situations. Non-functional requirements describe how well the system does it, or the constraints on it: performance, security, usability, reliability, and so on.

AspectFunctionalNon-functional
DescribesBehaviour, featuresQualities, constraints
Canteen example"The system shall send an SMS when the order is ready.""95% of order placements shall complete within 2 seconds."
Usually applies toA specific featureThe whole system or large parts of it
Tested byFunctional tests (input → expected output)Performance, load, security, usability tests
Effect of missing itA feature is absentThe whole system may be unusable (too slow, insecure)

Non-functional requirements are often more critical than functional ones. A banking app with every feature but a 30-second login will be abandoned.

Classification of non-functional requirements

Sommerville groups non-functional requirements by where they come from:

CategorySub-typesExample
Product requirementsUsability, efficiency (performance, space), dependability, security"The app shall be usable on Android phones with 2 GB RAM."
Organizational requirementsEnvironmental, operational, development (language, process)"Staff shall log in using the college's existing single sign-on."
External requirementsRegulatory, ethical, legislative (accounting, safety/security)"Personal data shall be handled as required by India's Digital Personal Data Protection Act, 2023."

Domain requirements

Some requirements come from the application domain rather than from a user's wish, for example "GST shall be computed on each bill as per the applicable rate", or in a railway system, the rules for signalling. They are easy to miss because domain experts consider them too obvious to mention.


The Requirements Engineering Process

Different textbooks divide the process differently, but they describe the same work.

Sommerville's view

   +--------------------+     +----------------+     +------------+
   | Elicitation and    | --> | Specification  | --> | Validation |
   | analysis           |     |                |     |            |
   +--------------------+     +----------------+     +------------+
             ^                                              |
             +------------- repeated in a spiral -----------+
   (often preceded by a Feasibility Study; supported throughout by
    Requirements Management)

Pressman's seven tasks

TaskWhat happens
1. InceptionEstablish a basic understanding of the problem, the stakeholders and the desired solution.
2. ElicitationDraw out requirements from stakeholders.
3. ElaborationRefine and expand them into an analysis model (scenarios, use cases, classes, flows).
4. NegotiationResolve conflicts and prioritize; balance features against cost and time.
5. SpecificationDocument them (written document, models, prototypes, or a mix).
6. ValidationCheck them for errors, ambiguity, omissions and conflicts.
7. Requirements managementTrack and control requirements and their changes throughout the project.

In practice these activities overlap and repeat, especially in agile projects where requirements are refined every Sprint.


Elicitation Techniques

Elicitation is hard because stakeholders often do not know exactly what they want, describe it in their own jargon, leave out "obvious" knowledge, have conflicting requirements, and change their minds. No single technique solves all of this, so teams combine several.

TechniqueHow it worksBest forWeakness
Interviews (closed or open)Question stakeholders one-to-one using prepared (closed) or free-flowing (open) questionsUnderstanding individual needs and pain pointsMisses tacit knowledge; time-consuming
Questionnaires / surveysWritten questions sent to many peopleLarge, spread-out user groups (e.g. 5,000 students)No follow-up questions; low response rates
Observation / ethnographyWatch people doing their actual workDiscovering how work is really done, including workaroundsSlow; people may act differently when watched
Workshops / JAD sessionsStructured group meetings of users and developers with a facilitator (Joint Application Development)Resolving conflicts quickly; building shared understandingDominant voices can take over
BrainstormingFree generation of ideas without criticism, then filteringNew products, innovative featuresProduces many ideas that need careful filtering
PrototypingShow a mock-up or partial system and collect feedback (see Prototyping Model)User interfaces; users who "know it when they see it"Users may think the prototype is nearly finished
Scenarios and use casesDescribe step-by-step interactions for specific situationsCapturing functional behaviour and exceptionsWeak for non-functional requirements
Document analysisStudy existing forms, reports, manuals, laws, legacy systemsDomain rules, data fields, replacing an old systemDocuments may be outdated

User stories

Agile teams usually write requirements as user stories:

As a <type of user>, I want <goal> so that <reason>.

As a student, I want to pre-order lunch during the morning break
so that I don't have to wait in the queue at 1 PM.

Acceptance criteria:
  - Pre-orders are accepted only between 8:00 and 11:30.
  - The student sees the pickup time and an order number.
  - If an item sells out, the student is notified and not charged for it.

A good story follows INVEST (Bill Wake): Independent, Negotiable, Valuable, Estimable, Small, Testable. The acceptance criteria are what make a story testable.


Analysis, Negotiation and Prioritization

Elicitation produces a large, messy set of wishes. Analysis organizes them: grouping related ones, removing duplicates, spotting conflicts, and checking which are feasible.

Example of a conflict

  • Canteen manager: "Orders must be prepaid online, so no food is wasted."

  • Administration: "Students without UPI must also be able to order."

Negotiation might produce: "Orders shall be prepaid online, except that a student may choose 'pay at counter' for up to 2 orders per week." Both sides give a little; the result is written down and agreed.

MoSCoW prioritization

Devised by Dai Clegg at Oracle in the 1990s and later made a core part of the DSDM agile method (now the Agile Business Consortium framework), MoSCoW is one of the most widely used prioritization schemes:

CategoryMeaningCanteen example
Must haveWithout it the release is useless or illegalPlace order, pay online, order number
Should haveImportant but there is a workaroundSMS when order is ready
Could haveNice to have if time allowsSave favourite orders
Won't have (this time)Agreed to be out of scope for nowDelivery to hostel rooms

Kano model

Noriaki Kano's model classifies features by how they affect satisfaction:

CategoryIf presentIf absentExample
Basic (must-be)Taken for granted, no extra delightStrong dissatisfactionCorrect bill amount
Performance (one-dimensional)More is betterLess is worseShorter wait time
Excitement (attractive)DelightNot missedLive "your dosa is on the tawa" status

Over time, excitement features become expected and turn into basic ones (think of online payment itself).


Writing Good Requirements

Most requirement defects are not missing features but badly written ones. Compare:

Poor requirementProblemBetter requirement
"The system should be fast."Not measurable; "fast" means different things to different people"95% of menu pages shall load within 1.5 seconds on a 4G connection with 500 concurrent users."
"The system shall be user-friendly."Not verifiable"A first-time user shall be able to place an order within 2 minutes without help, as measured in a test with 10 students."
"The system shall notify the user and update the stock and print a bill."Several requirements in one sentenceSplit into three numbered requirements
"The system may allow order cancellation.""May" is ambiguous about obligation"The system shall allow a student to cancel an order until the kitchen marks it 'Preparing'."
"Use a MySQL database with a table for orders."Design detail, not a requirement (unless it is a genuine constraint)"The system shall store each order for at least 3 years for audit."

Guidelines:

  • Use "shall" for mandatory requirements consistently.

  • One requirement per statement, with a unique ID (e.g. FR-12, NFR-3).

  • Make every requirement verifiable: if you cannot think of a test for it, rewrite it.

  • Say what, not how, unless the "how" is a real constraint.

  • Avoid vague words: fast, easy, flexible, robust, etc., and/or, as appropriate.


Requirements Validation

Validation asks: are these the requirements the stakeholders actually need, and are they written well? (Verification of the final product against the requirements happens later, in testing.)

What to check

CheckQuestion
ValidityDoes the requirement reflect a real need?
ConsistencyDoes it contradict another requirement?
CompletenessAre all needed functions and constraints included?
RealismCan it be built with the budget, time and technology available?
VerifiabilityCan we write a test that shows it is met?

Validation techniques

  • Requirements reviews: stakeholders and developers read the requirements systematically and raise issues.

  • Prototyping: users try a mock-up and confirm or correct the requirements.

  • Test-case generation: writing acceptance tests early; a requirement for which no test can be written is a problem.


Requirements Management and Traceability

Requirements change: new laws, new business priorities, better understanding by users. Requirements management makes those changes controlled instead of chaotic.

  • Each requirement gets a unique ID, a priority, a status and a source (who asked for it).

  • Changes go through a change control process: request, impact analysis (cost, schedule, affected parts), approval or rejection, then update.

  • Traceability links each requirement backwards to its source and forwards to the design, code and tests that implement it.

Example: a requirements traceability matrix (RTM)

+--------+--------------------------------+------------+--------------------+------------+
| Req ID | Requirement (short)            | Source     | Design / module    | Test cases |
+--------+--------------------------------+------------+--------------------+------------+
| FR-01  | Student logs in with college ID| Admin      | AuthService        | TC-01,02   |
| FR-05  | Place order (1-10 items)       | Students   | OrderService       | TC-10..14  |
| FR-08  | SMS when order ready           | Students   | NotificationSvc    | TC-20      |
| NFR-02 | 95% orders placed in ≤ 2 s     | Admin      | OrderService, DB   | PT-03      |
| NFR-05 | Store orders ≥ 3 years         | Accounts   | Archival job       | TC-41      |
+--------+--------------------------------+------------+--------------------+------------+

With this matrix, if Accounts asks to change FR-05, you immediately see which module and which tests are affected. And a requirement with an empty "Test cases" column is a requirement nobody has checked.


Common Mistakes

  • Talking only to the person who pays. End users, operators and regulators have requirements too.

  • Ignoring non-functional requirements until the end, when performance or security problems are hardest to fix.

  • Writing vague, untestable statements such as "fast" or "user-friendly".

  • Mixing design into requirements and so closing off better solutions.

  • Treating requirements as frozen. They will change; manage the change instead of pretending it will not happen.

  • Confusing validation and verification. Validation: right requirements (right product). Verification: product built to those requirements.


Interview and Exam Questions

Q1. Classify: (a) "The system shall generate a monthly sales report." (b) "The report shall be generated within 10 seconds." (c) "The system shall be developed in Java as per company policy."

(a) Functional. (b) Non-functional, product requirement (performance/efficiency). (c) Non-functional, organizational requirement (development).

Q2. List the requirements engineering tasks given by Pressman.

Inception, elicitation, elaboration, negotiation, specification, validation, requirements management.

Q3. Why is elicitation difficult?

Stakeholders may not know what they want or cannot express it, use domain jargon, omit tacit "obvious" knowledge, have conflicting needs, and change their requirements; political and organizational factors also influence what is said.

Q4. Rewrite "The app should load quickly" as a good requirement.

For example: "The home screen shall be displayed within 2 seconds of launch for 95% of launches on devices with at least 3 GB RAM over a 4G connection." It is now measurable and testable.

Q5. What is a requirements traceability matrix and why is it useful?

A table linking each requirement to its source, design elements and test cases. It supports impact analysis for changes, ensures every requirement is implemented and tested, and shows that no code or test exists without a reason.

Q6. Explain MoSCoW.

A prioritization scheme: Must have, Should have, Could have, Won't have (this time). It forces stakeholders to agree what is essential for a release and what can wait.


Summary

  • Requirements engineering discovers, analyses, documents, validates and manages what a system must do.

  • User vs system requirements differ in audience and detail; functional vs non-functional differ in what vs how well.

  • Non-functional requirements: product, organizational, external (Sommerville).

  • Process (Pressman): inception, elicitation, elaboration, negotiation, specification, validation, management.

  • Elicitation uses many techniques: interviews, questionnaires, observation, workshops, prototyping, use cases, user stories.

  • Prioritize with MoSCoW or Kano; write requirements that are clear, single, verifiable and free of design.

  • Validate with reviews, prototypes and test cases; manage change with IDs, change control and traceability.

The output of this process is usually written down as a Software Requirements Specification, which is the subject of the next chapter.

If you cannot test a requirement, you have not finished writing it.