Professional Documents
Culture Documents
Chapter 2 Requirements and Specification 2024
Chapter 2 Requirements and Specification 2024
Specification
Learning outcome
•Requirements engineering
•Modeling types
•System Prototyping
•Formal sepcification
Requirements Engineering
• Theprocess of establishing the services that the customer requires from a system and the constraints
under which it operates and is developed.
• Therequirements themselves are the descriptions of the system services and constraints that are
generated during the requirements engineering process.
• It
may range from a high-level abstract statement of a service or of a system constraint to a detailed
mathematical functional specification.
May state what the system should not do. Often apply to the system as a whole rather than individual
features or services.
Describe functionality or system services.
These define system properties and constraints e.g.
Depend on the type of software, expected users and the reliability, response time, and storage requirements.
type of system where the software is used. Constraints are I/O device capability, system
representations, etc.
Functional user requirements may be high-level
statements of what the system should do. Process requirements may also be specified mandating a
particular IDE, programming language or development
Functional system requirements should describe the method.
system services in detail.
Non-functional requirements may be more critical than
functional requirements. If these are not met, the system
may be useless.
Types of Non-Functional Requirements
Non-functional requirements may affect the overall
architecture of a system rather than the individual
components.
Verifiable non-functional requirement Medical staff shall be able to use all the system
A statement using some measure that can be objectively functions after four hours of training. After this training,
tested. the average number of errors made by experienced
users shall not exceed two per hour of system use.
Goals are helpful to developers as they convey the (Testable non-functional requirement)
intentions of the system users.
Non-Functional Requirements Metrics
Domain Requirements
• Domain requirements Problems of Domain Requirements
•The system’s operational domain (constraints) imposes requirements
on the system. Understandability
Requirements are expressed in the language of the
For example, a train control system has to take into account the braking application domain;
characteristics in different weather conditions.
This is often not understood by software engineers
•Domain requirements can be new functional requirements, constraints developing the system.
on existing requirements, or define specific computations.
Implicitness
• If domain requirements are not satisfied, the system may be Domain specialists understand the area so well
unworkable. that they do not think of making the domain
requirements explicit.
Requirements Specification
The process of writing down the user and system requirements in a requirements
document
User requirements have to be understandable by end-users and customers who do
not have a technical background
System requirements are more detailed requirements and may include more technical
information
The requirements may be part of a contract for the system development
It is therefore important that these are as complete as possible
Ways to write Requirements
Specification
Guideline
Create a standard format and use it for all
requirements.
Examples
Insulin Pump (Example)
Structured Specification
An approach to writing requirements where the
freedom of the requirements writer is limited and
requirements are written in a standard way.
Types of interview They should include People do not have to explain or articulate their
Closed interviews based on pre-determined list of questions A description of the starting situation; work.
Open interviews where various issues are explored with A description of the normal flow of events;
stakeholders. A description of what can go wrong; Social and organisational factors of importance
Information about other concurrent may be observed.
Effective interviewing activities;
Be open-minded, avoid pre-conceived ideas about the A description of the state when the scenario Ethnographic studies have shown that work is
requirements and are willing to listen to stakeholders. finishes. usually richer and more complex than suggested by
Prompt the interviewee to get discussions going using a simple system models.
springboard question, a requirements proposal, or by working
together on a prototype system. Ethnography is effective for understanding existing
processes but cannot identify new features that
Normally a mix of closed and open-ended interviewing. should be added to a system.
Regular reviews should be held while the requirements definition is being formulated.
Both client and contractor staff should be involved in reviews.
Reviews may be formal (with completed documents) or informal. Good communications between developers,
customers and users can resolve problems at an early stage.
Prototyping
Test-case generation
Developing tests for requirements to check testability.
Requirements Management
Requirements management is the process of managing changing requirements during the requirements
engineering process and system development.
New requirements emerge as a system is being developed and after it has gone into use.
You need to keep track of individual requirements and maintain links between dependent requirements so
that you can assess the impact of requirements changes. You need to establish a formal process for making
change proposals and linking these to system requirements.
Changing Requirements
The business and technical environment of the system always changes after installation.
New hardware may be introduced, it may be necessary to interface the system with other systems, business
priorities may change (with consequent changes in the system support required), and new legislation and
regulations may be introduced that the system must necessarily abide by.
The people who pay for a system and the users of that system are rarely the same people.
System customers impose requirements because of organizational and budgetary constraints. These may
conflict with end-user requirements and, after delivery, new features may have to be added for user support if
the system is to meet its goals.
Large systems usually have a diverse user community, with many users having different
requirements and priorities that may be conflicting or contradictory.
The final system requirements are inevitably a compromise between them and, with experience, it is often
discovered that the balance of support given to different users has to be changed.
Requirements Change Management
Deciding if a requirements change should be Requirements management decisions:
accepted
Requirements identificationEach requirement must be
Problem analysis and change specification uniquely identified so that it can be cross-referenced with
During this stage, the problem or the change proposal is analyzed to other requirements.
check that it is valid. This analysis is fed back to the change requestor
who may respond with a more specific requirements change proposal,
A change management processThis is the set of activities
or decide to withdraw the request. that assess the impact and cost of changes. I discuss this
Change analysis and costing process in more detail in the following section.
The effect of the proposed change is assessed using traceability Traceability policiesThese policies define the relationships
information and general knowledge of the system requirements. Once between each requirement and between the requirements
this analysis is completed, a decision is made whether or not to and the system design that should be recorded.
proceed with the requirements change. Tool supportTools that may be used range from specialist
Change implementation requirements management systems to spreadsheets and
The requirements document and, where necessary, the system
design and implementation, are modified. Ideally, the document should
simple database systems.
be organized so that changes can be easily implemented.
System Modelling
•System modelling helps the analyst to understand the functionality of the system and models are
used to communicate with customers.
•Different models present the system from different perspectives
External perspective showing the system’s context or environment
Behavioural perspective showing the behaviour of the system
Structural perspective showing the system or data architecture
Modeling Types
•Data processing model showing how the data is processed at
different stages.
•Composition model showing how entities are composed of
other entities.
•Architectural model showing principal sub-systems.
•Classification model showing how entities have common
characteristics.
•Stimulus/response model showing the system’s reaction to
events.
Context Model
ATM (Example)
•Context models are used to illustrate the operational
context of a system -they show what lies outside the
system boundaries.
•Social
and organisational concerns may affect the decision
on where to position system boundaries.
•Tracking and documenting how the data associated with a process is helpful to develop an overall understanding of the system.
Insulin Pump
(Example)
Microwave Oven Model (State Machine
Model Example)
State Charts
•State
Charts allow the decomposition of a model into
sub-models
•Advantages
The development starts with those requirements which are best understood.
Advantages Problems
•Verification is impossible as there is no specification. Management problems
Accelerated delivery of the system
User engagement with the system Maintenance problems
•Validation means demonstrating the adequacy of the system. Contractual problems
Throw-away Prototyping
A prototype which is usually a practical implementation of the system is produced to help discover
requirements problems and then discarded. The system is then developed using some other development
process
•Used to reduce requirements risk
•The prototype is developed from an initial specification, delivered for experiment then discarded
The prototyping process starts with those requirements which are poorly understood
•The objective of throw-away prototyping is to validate or derive the system requirements.
•The throw-away prototype should NOT be considered as a final system
Some system characteristics may have been left out
There is no specification for long-term maintenance
The system will be poorly structured and difficult to maintain
Throw-away Prototyping
Problems with Throw-away Prototyping
•Developers may be pressurised to deliver a throw-away prototype as a final system
•This is not recommended
It may be impossible to tune the prototype to meet non-functional requirements
The prototype is inevitably undocumented
The system structure will be degraded through changes made during development
Normal organisational quality standards may not have been applied
Formal Specifications
•Formalspecification is part of a more general collection of techniques that are known as ‘formal
methods’.
•These are all based on mathematical representation and analysis of software.
•Formal methods include
Formal specification
Specification analysis and proof
Transformational development
Program verification
Acceptance of Formal Methods
•Formal methods have not become mainstream software development techniques as was once
predicted
Other software engineering techniques have been successful at increasing system quality.
Hence the need for formal methods has been reduced.
Market changes have made time-to-market rather than software with a low error count the key
factor. Formal methods do not reduce time to market.
The scope of formal methods is limited. They are not well-suited to specifying and analysing
user interfaces and user interaction.
Formal methods are still hard to scale up to large systems.
Use of Formal Methods
•The principal benefits of formal methods are in reducing the number of faults in systems.
•Consequently, their main area of applicability is in critical systems engineering. There have been
several successful projects where formal methods have been used in this area.
•In this area, the use of formal methods is most likely to be cost-effective because high system
failure costs must be avoided.
Specification Components
•Introduction
Defines the sort (the type name) and declares other specifications Graphical Representation
that are used.
•Description
•Inspection operations: operations which evaluate entities of the type being specified
◦ First, Last, Eval
---------------------------------------------
Rule of Thumb for Defining Axioms: define an axiom which sets out what is always true for
each inspection operation over each constructor.
Description of Array
• Arrays are collections of elements of generic type Elem.
Create
takes the array bounds as parameters and creates the array, initializing its
values to Undefined.
Assign
creates a new array which is the same as the input with the specified
element assigned the given value.
Eval
reveals the value of a specified element. If an attempt is made to access
a value outside the bounds of the array, the value is undefined.
Informal Description of Array
Array Signature Array Axiom
•Create (Integer, Integer) → Array 1.First (Create (x, y)) = x
•Assign (Array, Integer, Elem) → Array 2.First (Assign (a, n, v)) = First (a)
•First (Array) → Integer 3.Last (Create (x, y)) = y
•Last (Array) → Integer 4.Last (Assign (a, n, v)) = Last (a)
•Eval (Array, Integer) → Elem 5.Eval (Create (x, y), n) = Undefined
6.Eval (Assign (a, n, v), m) = if m < First (a) or
m > Last (a) then Undefined else
If m = n then v else Eval (a, m)
Example
Let: A1 := Assign (Create (1, 3), 3, c)
A2 := Assign (A1, 2, b) By axiom 6,
Eval (Assign (A2, 1, a), 2) = if 2 < First (A2) = 1 or 2 > Last
A2 = [Undefined, b, c]
(A2) = 3 then Undefined else if 2 = 1 then a else Eval (A2, 2)
1 2 3
= Eval (A2, 2) = Eval (Assign (A1, 2, b), 2)
What is the value of:
3.Eval
(Assign (Create (3, -2), 1, c), 1) By axiom 6,
= Undefined
Eval (Assign (Create (3, -2), 1, c), 1) =
if 1< 3 or 1 > -2 then Undefined else…
= Undefined
Specification Instantiation
•A simple form of reuse.
•An existing specification utilizing a generic parameter is instantiated with some other sort, e.g.:
CHAR_ARRAY: ARRAY
sortChar_array instantiatesArray (Elem:=Char) importsINTEGER
Model Based Specification
•Algebraic specification is suited to subsystem interface
specification, where outputs of operations only depend
on the input parameters
Characteristic
•System model defined using well-understood
•Algebraicspecification can be cumbersome when the mathematical entities like sets and functions
object operations are not independent of the object •System state is not hidden like it is in algebraic
state. specification
•Model-based specification exposes the system state •State changes are straight forward to define
and defines the operations in terms of changes to that
•VDM and Z are the most widely used model-
state. based specification languages
•The Z notation is a mature technique for model-based
specification. It combines formal and informal
description and uses graphical highlighting when
presenting specifications.
Z Formal Language
•Based on set theory and first-order predicate logic
•Strongly typed
•Declarative language
•Makes use of a graphical construction known as a schema
provide an effective low level structuring facility
are useful as specification building blocks
can be understood fairly easily
Schemas
•Include
a unique name or identifier
a signature that declares entities and their types
a predicate part that defines invariants involving these entities
•Schemas can be included in other schemas and act as type definitions
•Names are local to the schema in which they are defined
Schemas: Declaration
•Contains local declarations (types and variables)
•Can import other types by listing their names
•Anonymous schemas (name omitted) are used to make global declarations
•Anonymous schemas usually do not contain a predicate part
Schemas: Predicate
•Statements about the entities defined in the declaration part of the schema
•These statements must be true at all times
•Multiple statements are assumed to be implicitly connected by a logical and
•Other logical connectives (e.g. or, implies, equivalent, etc.) can be used explicitly in compound
statements
Example Schema
• The symbol P is used to indicate the power set of a type, and the
• Symbol is used to define a relation between two types (i.e. a set of ordered pairs from the
Cartesian product of the two types).
Z-Schema
Foundation of Z
•Model theoretic method
abstract model is constructed
properties of the model are proven
•Set theory (and other discrete math)
•First order predicate calculus
•Schema calculus provides incrementality
Predicate Logic Set Theory Functions & Relations