Requirements Analysis and Specification (Lecture 3)
Prof. R. Mall
Dept. of CSE, IIT, Kharagpur
Organization of this Lecture
Introduction Requirements analysis Requirements specification SRS document
Decision table
Decision tree
Summary
2
Requirements Analysis and Specification Many projects fail:
Because
they start implementing the system.
Without
determining whether they are building what the customer really wants.
Requirements Analysis and Specification
It is important to learn:
Requirements
analysis and specification techniques carefully.
Goals of requirements analysis and specification phase:
Requirements Analysis and Specification
Fully understand the user requirements.
Remove inconsistencies, anomalies, etc. from requirements. Document requirements properly in an SRS document.
Requirements Analysis and Specification
Consists of two distinct activities: Requirements Gathering and Analysis
Specification
Who Carries Out Requirements Analysis and Specification?
The person who undertakes requirements analysis and specification:
Known as systems analyst:
Collects data pertaining to the product
Analyzes collected data:
To understand what exactly needs to be done.
Writes the Software Requirements Specification (SRS) document.
7
Requirements Analysis and Specification
Final output of this phase:
Software Requirements Specification (SRS) Document.
The SRS document is reviewed by the customer.
Reviewed SRS document forms the basis
of all future development activities.
Requirements Analysis
Requirements analysis consists of two main activities:
Requirements Analysis
gathering
of the gathered requirements
Requirements Analysis
Analyst gathers requirements through:
Observation of existing systems, Studying existing procedures, Discussion with the customer and endusers, Analysis of what needs to be done, etc.
10
Requirements Gathering
Also known as requirements elicitation. If the project is to automate some existing procedures
e.g., automating existing manual accounting activities,
The task of the system analyst is a little easier
Analyst can immediately obtain:
input and output formats accurate details of the operational procedures
11
Requirements Gathering Activities
1. Studying the existing documentation 2. Interview
3. Task analysis
4. Scenario analysis
5. Form analysis
12
Requirements Gathering
(CONT.)
In the absence of a working system,
Lot
of imagination and creativity are required.
Interacting with the customer to gather relevant data:
Requires
a lot of experience.
13
Requirements Gathering
(CONT.)
Some desirable attributes of a good system analyst:
Good
interaction skills,
Imagination
Experience.
and creativity,
14
Case Study: Automation of Office Work at CSE Dept.
The academic, inventory, and financial information at the CSE department:
Being carried though manual processing by two office clerks, a store keeper, and two attendants.
Considering the low budget he had at his Disposal:
The HoD entrusted the work to a team of student volunteers.
15
Case Study: Automation of Office Work at CSE Dept.
The team was first briefed by the HoD about the specific activities to be automated. The analyst first discussed with the two clerks:
Regarding their specific responsibilities (tasks) that were to be automated.
The analyst also interviewed student and faculty representatives who would also use the software.
16
Case Study: Automation of Office Work at CSE Dept.
For each task, they asked:
About
the steps through which these are performed. They also discussed various scenarios that might arise for each task. The analyst collected all types of forms that were being used.
17
Analysis of the Gathered Requirements
Main purpose of requirements analysis:
Clearly understand the user requirements,
Detect inconsistencies, ambiguities, and incompleteness.
Incompleteness and inconsistencies:
Resolved through further discussions with the end-users and the customers.
18
Inconsistent Requirement
Some part of the requirement:
contradicts with some other part. One customer says turn off heater and open water shower when temperature > 100 C Another customer says turn off heater and turn ON cooler when temperature > 100 C
19
Example:
Incomplete Requirement
Some requirements have been omitted:
Possibly
due to oversight.
Example:
The analyst has not recorded: when temperature falls below 90 C
heater should be turned ON water shower turned OFF.
20
Requirements analysis involves:
Obtaining
Analysis of the Gathered Requirements (CONT.)
a clear, in-depth understanding of the product to be developed, all ambiguities and inconsistencies from the initial customer perception of the problem.
Remove
21
Analysis of the Gathered Requirements (CONT.)
It is quite difficult to obtain:
A
clear, in-depth understanding of the problem:
Especially if there is no working model of the problem.
22
Analysis of the Gathered Requirements (CONT.)
Experienced analysts take considerable time:
To
understand the exact requirements the customer has in his mind.
23
Analysis of the Gathered Requirements (CONT.)
Experienced systems analysts know often as a result of painful experiences --
Without a clear understanding of the problem, it is impossible to develop a satisfactory system.
24
Analysis of the Gathered Requirements(CONT.)
Several things about the project should be clearly understood by the analyst:
What is the problem?
Why is it important to solve the problem?
What are the possible solutions to the problem?
What complexities might arise while solving the problem?
25
Some anomalies and inconsistencies can be very subtle:
Analysis of the Gathered Requirements(CONT.)
Escape even most experienced eyes.
If a formal model of the system is constructed,
Many of the subtle anomalies and inconsistencies get detected.
26
Analysis of the Gathered Requirements(CONT.)
After collecting all data regarding the system to be developed,
Remove all inconsistencies and anomalies from the requirements,
Systematically organize requirements into a Software Requirements Specification (SRS) document.
27
Software Requirements Specification
Main aim of requirements specification:
Systematically organize the requirements arrived during requirements analysis.
Document requirements properly.
28
Software Requirements Specification
The SRS document is useful in various contexts:
Statement of user needs
Contract document
Reference document
Definition for implementation
29
Software Requirements Specification: A Contract Document
Requirements document is a reference document.
SRS document is a contract between the development team and the customer.
Once the SRS document is approved by the customer,
Any subsequent controversies are settled by referring the SRS document.
30
Software Requirements Specification: A Contract Document
Once customer agrees to the SRS document:
Development team starts to develop the product according to the requirements recorded in the SRS document.
The final product will be acceptable to the customer:
As long as it satisfies all the requirements recorded in the SRS document.
31
SRS Document
(CONT.)
The SRS document is known as black-box specification:
The system is considered as a black box whose internal details are not known. Only its visible external (i.e. input/output) behavior is documented.
Input Data
Output Data
32
SRS Document
(CONT.)
SRS document concentrates on:
What needs to be done Carefully avoids the solution (how to do) aspects.
The SRS document serves as a contract
Between development team and the customer.
Should be carefully written
33
SRS Document
(CONT.)
The requirements at this stage:
Written
using end-user terminology.
If necessary:
Later
a formal requirement specification may be developed from it.
34
Properties of a Good SRS Document
It should be concise
and at the same time should not be ambiguous. and not say how to do it.
It should specify what the system must do
Easy to change.,
i.e. it should be well-structured.
It should be consistent. It should be complete.
35
Properties of a Good SRS Document (cont...)
It should be traceable
You
should be able to trace which part of the specification corresponds to which part of the design, code, etc and vice versa.
e.g. system should be user friendly is not verifiable
36
It should be verifiable
SRS Document
(CONT.)
SRS document, normally contains three important parts:
Functional
requirements,
Non-functional Goals
requirements,
of Implementation.
37
SRS Document
(CONT.)
It is desirable to consider every system:
Performing a set of functions {fi}.
Each function fi considered as:
Transforming a set of input data to corresponding output data.
Input Data Output Data
fi
38
F1: Search Book
Example: Functional Requirement
an authors name:
Input:
Output:
details of the authors books and the locations of these books in the library.
Author Name Book Details
f1
39
Functional Requirements
Functional requirements describe:
A set of high-level requirements Each high-level requirement:
takes in some data from the user outputs some data to the user
Each high-level requirement:
might consist of a set of identifiable functions
40
Functional Requirements
For each high-level requirement:
Every
of:
function is described in terms
Input data set Output data set Processing required to obtain the output data set from the input data set.
41
Nonfunctional Requirements
Characteristics of the system which can not be expressed as functions:
Maintainability,
Portability,
Usability, etc.
42
Nonfunctional Requirements
Nonfunctional requirements include:
Reliability issues,
Performance issues:
Example: How fast the system can produce results
so that it does not overload another system to which it supplies data, etc.
Human-computer interface issues, Interface with other external systems, Security, maintainability, etc.
43
Non-Functional Requirements
Hardware to be used, Operating system
or DBMS to be used
Capabilities of I/O devices Standards compliance Data representations
by the interfaced system
44
Goals of Implementation
Goals describe things that are desirable of the system:
But, would not be checked for compliance.
For example,
Reusability issues Functionalities to be developed in future
45
Organization of the SRS Document
Introduction. Functional Requirements Nonfunctional Requirements
External interface requirements Performance requirements
Goals of implementation
46
Functional Requirements
A high-level function is one:
Using which the user can get some useful piece of work done.
Can the receipt printing work during withdrawal of money from an ATM:
Be called a useful piece of work?
A high-level requirement typically involves:
Accepting some data from the user,
Transforming it to the required response, and then Outputting the system response to the user.
47
High-Level Function
A high-level function:
Usually involves a series of interactions between the system and one or more users.
Even for the same high-level function,
There can be different interaction sequences (or scenarios) Due to users selecting different options or entering different data items.
48
Example Functional Requirements
List all functional requirements Req. 1:
with proper numbering.
Once the user selects the search option,
The system should output details of all books
he is asked to enter the key words.
whose title or author name matches any of the key words entered. Details include: Title, Author Name, Publisher name, Year of Publication, ISBN Number, Catalog Number, Location in the Library.
49
Example Functional Requirements
Req. 2:
When the renew option is selected,
The user is asked to enter his membership number and password. The list of the books borrowed by him are displayed. By clicking in the corresponding renew box.
50
After password validation,
The user can renew any of the books:
Req. 1:
R.1.1:
Input: search option, Output: user prompted to enter the key words. Input: key words Output: Details of all books whose title or author name matches any of the key words.
R1.2:
Details include: Title, Author Name, Publisher name, Year of Publication, ISBN Number, Catalog Number, Location in the Library.
Processing: Search the book list for the keywords
51
Req. 2:
R2.1:
R2.2:
Input: renew option selected, Output: user prompted to enter his membership number and password. Input: membership number and password Output:
Processing: Password validation, search books issued to the user from borrower list and display.
list of the books borrowed by user are displayed. User prompted to enter books to be renewed or user informed about bad password
52
Req. 2:
R2.3:
Input: user choice for renewal of the books issued to him through mouse clicks in the corresponding renew box. Output: Confirmation of the books renewed
Processing: Renew the books selected by the in the borrower list.
53
Unstructured Specifications:
Examples of Bad SRS Documents
Narrative essay --- one of the worst types of specification document:
Difficult to change,
Difficult to be precise,
Difficult to be unambiguous, Scope for contradictions, etc.
54
Noise:
Examples of Bad SRS Documents
Presence of text containing information irrelevant to the problem.
Silence:
aspects important to proper solution of the problem are omitted.
55
Examples of Bad SRS Documents
Overspecification:
Addressing how to aspects
For example, Library member names should be stored in a sorted descending order
Overspecification restricts the solution space for the designer. Contradictions might arise
Contradictions:
if the same thing described at several places in different ways.
56
Ambiguity:
Examples of Bad SRS Documents
Literary expressions
Unquantifiable aspects, e.g. good user interface
References to aspects of problem
Forward References:
defined only later on in the text.
Wishful Thinking:
Descriptions of aspects
for which realistic solutions will be hard to find.
57
Representation of complex processing logic:
Decision trees Decision tables
58
Decision Trees
Decision trees:
Edges of a decision tree represent conditions Leaf nodes represent actions to be performed. Logic involved in decision making Corresponding actions taken.
A decision tree gives a graphic view of:
59
Example: LMS
A Library Membership automation Software (LMS) should support the following three options:
New member, Renewal,
Cancel membership.
60
Example: LMS
When the new member option is selected,
The software asks details about the member:
name,
address, phone number, etc.
61
Example(cont.)
If proper information is entered,
A membership record for the member is created A bill is printed for the annual membership charge plus the security deposit payable.
62
Example(cont.)
If the renewal option is chosen,
LMS asks the member's name and his membership number
checks whether he is a valid member.
the membership expiry date is updated and the annual membership bill is printed, otherwise an error message is displayed.
If the name represents a valid member,
63
Example(cont.)
If the cancel membership option is selected and the name of a valid member is entered,
The membership is cancelled,
A cheque for the balance amount due to the member is printed
The membership record is deleted.
64
Decision Tree
New member User input
Renewal Cancel
- Get details - Create record - Print bills - Get Details - Update record - Print bills - Get Details - Print Cheque - Delete record - Print error message
Invalid option
65
Decision Table
Decision tables specify:
Which What The
variables are to be tested
actions are to be taken if the conditions are true, order in which decision making is performed.
66
Decision Table
A decision table shows in a tabular form:
Upper rows of the table specify:
Processing logic and corresponding actions
The variables or conditions to be evaluated The actions to be taken when the corresponding conditions are satisfied.
67
Lower rows specify:
Decision Table
In technical terminology,
a
column of the table is called a rule: rule implies:
if a condition is true, then execute the corresponding action.
68
Example:
Conditions Valid selection NO New member -- YES Renewal -- NO Cancellation -Actions Display error message Ask member's name etc. Build customer record -Generate bill -Ask membership details Update expiry date -Print cheque -Delete record -- --
YES NO YES NO
--
YES NO NO NO
--
YES YES
--
--
-----
----
--
69
Comparison
Both decision tables and decision trees
Can represent complex program logic.
Decision trees are easier to read and understand
When the number of conditions are small.
Decision tables help to look at every possible combination of conditions.
70
Formal Specification
A formal specification technique is a mathematical method to:
Accurately Verify Prove
specify a system.
that implementation satisfies specification. properties of the specification.
71
Formal Specification
Advantages:
Automated
Well-defined
semantics, no scope for ambiguity tools can check properties of specifications
specification
72
Executable
Formal Specification
Disadvantages of formal specification techniques:
Difficult
to learn and use
Not
able to handle complex systems
73
Formal Specification
Mathematical techniques used include:
Logic-based
set
theoretic
specification
algebraic
finite
state machines, etc.
74
Semiformal Specification
Structured specification languages
SADT (Structured Analysis and Design Technique) PSL/PSA (Problem Statement Language/Problem Statement Analyzer)
PSL is a semi-formal specification language PSA can analyze the specifications expressed in PSL
75
Executable Specification Language
If specification is expressed in formal language:
it
becomes possible to execute the specification to provide a system prototype.
However, executable specifications are usually slow and inefficient.
76
Executable Specification Language
Executable specifications only test functional requirements:
If
non-functional requirements are important for some product,
The utility of an executable specification prototype is limited.
77
4GLs
4GLs (Fourth Generation Languages) are examples of
executable because
specification languages.
4GLs are successful
there is a lot of commonality across data processing applications.
78
4GLs
4GLs rely on software reuse
Where common abstractions have been identified and parameterized.
Rewriting 4GL programs in higher level languages:
Result in upto 50% lower memory requirements
Also the programs run upto 10 times faster.
79
Summary
Requirements analysis and specification
An important phase of software development:
Any error in this phase would affect all subsequent phases of development. Requirements gathering and analysis Requirements specification
80
Consists of two different activities:
Summary
The aims of requirements analysis:
Gather all user requirements
Clearly understand exact user requirements Remove inconsistencies and incompleteness. Systematically organize requirements
The goal of specification:
Document the requirements in an SRS document.
81
Summary
Main components of SRS document:
Functional
requirements
Non-functional Constraints
requirements
Techniques to express complex logic:
Decision
tree
Decision
table
82
Summary
Formal requirements specifications have several advantages.
But
the major shortcoming is that these are hard to use.
83