Title: Chapter Three
1Software Engineering
- Chapter Three
- Requirements Engineering
- Objectives
- Be able to define requirements engineering
- Be able to structure a requirements document
- Be able to write verifiable functional and
non-functional requirements - Be able to describe the evolution of requirements
- Be able to create UML use-case descriptions
- Be able to draw UML use-case diagrams
2Requirements engineering
- The process of establishing the services that the
customer requires from a system and the
constraints under which it operates and is
developed - What is a requirement?
- It may range from a high-level abstract statement
of a service or of a system constraint to a
detailed mathematical functional specification - Requirements may serve a dual function
- May be the basis for a bid for a contract -
therefore must be open to interpretation - May be the basis for the contract itself -
therefore must be defined in detail - Both these statements may be called requirements
3Requirements definition/specification
- Requirements definition
- A statement in natural language plus diagrams of
the services the system provides and its
operational constraints. Written for customers - Requirements specification
- A structured document setting out detailed
descriptions of the system services. Written as a
contract between client and contractor. For
customers developers - Software specification
- A detailed software description which can serve
as a basis for a design or implementation.
Written for developers
4Problems with requirements definition
- Hard to anticipate the effects that the new
system will have on the organisation - Different users have different requirements and
priorities. - System end-users and organisations who pay for
the system have different requirements - Prototyping often required to clarify
requirements - Natural language problems
5How are requirements elicited?
- Interviews
- Gives best information
- expensive
- Questionnaires
- Good if many people involved especially if
dispersed - Tend to have poor responses
- Observation
- Accurate if done well
- expensive
- Searching
- Limited information
- Tends not to reveal potential problems
6The requirements document
- The requirements document is the official
statement of what is required of the system
developers - Should include both a definition and a
specification of requirements - It is NOT a design document. As far as possible,
it should set of WHAT the system should do rather
than HOW it should do it
7Requirements document structure
- SECTION 1 Introduction
- purpose (including audience)
- Scope (what the product does/does not), benefits,
obectives - definitions, acronyms
- References
- Overview of Document
- SECTION 2 Overall Description
- Product Perspective - How product relates to
other systems - Product Functions high level description of
each function - User Characteristics
- Constraints. E.g. Hardware, safety, standards etc
- Assumptions
8Requirements document structure
- SECTION 3 Specific Requirements
- Minimum
- Inputs
- Outputs
- All functions performed in response to inputs and
outputs - Complete List
- External Interfaces (Names, description, source,
valid range, unit, - Functions
- actions that take place
- The system shall
- Specific detail of each function see form based
requirements specification - Performance Requirements
- Database Requirements
- Design Constraints e.g. standards
- Non-functional requirements (more about these
later)
9- SECTION 3 continued
- Organisation of the SECTION 3
- By system mode
- Training, normal, emergency
- By user class
- By objects
- By feature
- By stimulus (Especially real-time systems e.g.
pressure change) - By response (everything to do with a certain
output e.g. producing invoices) - APPENDICES
- E.g. sample inputs, cost analyses, user surveys,
background information - INDEX
10Example 1
11Example 2
12Requirements Specification - good practice
- Use a form-based approach
- describe each function in a separate form
13Pre Post conditions
- pre-condition (what must be true for the function
to execute correctly) - post-condition (what is guaranteed to be true
after the function executes) - Example A merge function may be specified as
follows - merge(item1array,item2array) newArray
- Pre
- SizeOf(Item1)gt0, SizeOf(Item2)gt0, (both arrays
have at least one element) - item1iltitem1i1, 1ltiltnoOfItems1 (in order)
- item2iltitem2i1, 1ltiltnoOfItems2 (in order)
- Post
- SizeOf(newArray) SizeOf(Item1)gt SizeOf(Item2)
- newArrayi lt newArrayi1, 1ltilt
SizeOf(newArray) - These are all testable!
14Non-functional requirements
- Define system properties and constraints e.g.
reliability, response time and storage
requirements. Constraints are I/O device
capability, system representations, etc. - Process requirements may also be specified
mandating a particular CASE system, programming
language or development method - Non-functional requirements may be more critical
than functional requirements. If these are not
met, the system is useless - Typically
- Reliability, Security, Availability,
Maintainability, Portability, Performance
15Requirements Verifiability
- Requirements should be written so that they can
be objectively verified - The problem with this requirement is its use of
vague terms such as errors shall be minimised - The system should be easy to use by experienced
controllers and should be organised in such a way
that user errors are minimised. - The error rate should be quantified
- Experienced controllers should be able to use all
the system functions after a total of two hours
training. After this training, the average number
of errors made by experienced users should not
exceed two per day.
16Non-functional requirements measures
17UML - Use-Case Modelling
- Use-case models describe externally the visible
behavior of a system - Provides a view of the users of the system and
the functions that the system must perform - Use-cases are initiated by users or systems
called Actors - An actor represents anything that needs to
interact with the system to exchange information
it may be a role a user plays or another
system. - The actor initiates system activity, a use case,
for the purposes of completing some task. - If an external party initiates the input, it is
considered an actor - Potential human users of the system, identify
their roles - Interactions with external systems
- Use-case diagrams are used primarily during the
requirements analysis stage - define the complete functionality of a system
from a user perspective
18Example Diagram editor tool
- From Practical Object Oriented Design with UML
Mark Priestly - Users create and edit drawings composed of lines,
rectangles, ellipses and text. - Tools control the operation of the editor.
Exactly one tool is active at a time. - There are 2 kinds of tool selection tools and
creation tools. - With the selection tool active, the use can
select drawing elements with the cursor - More than one element can be selected and
manipulated as if they were one - The current selection is displayed visually by
showing control points for the elements. Control
points can be dragged to change the element shape - When the creation tool becomes active, there is
no current selection - On creation of an element it becomes the current
selection - Text Element
- The text creation tool changes the cursor to an I
beam and the user can click this on the screen
and start typing at that point - The text creation tool is no longer active once
the user clicks outside the text element - The control points for a text element are its 4
corners dragging this changes the region
19- Other Creation tools
- Lines, rectangles ellipses
- In these cases the cursor becomes a crosshair
- MouseDown starts to create the object, Mouseup
completes up - MouseDown sets the start point of the element,
Mouseup the end point - Line start point where MouseDown, end point at
MouseUp. These points are also the control points - Rectangle top left point where MouseDown,
bottom right point at MouseUp. These points and
the other corners become the control points - Ellipse draws an ellipse to fit inside the
rectangle drawn as with the rectangle tool. The
rectangle does not appear, but its corners form
control points for the ellipse
20Use Case Diagram
- Use Case diagram summarises all the use cases and
actors in the system - Where necessary, scenarios are developed for the
use cases - Use-cases are described only in terms of the
services they offer to external actors. - The internal details of precisely how this
external behavior is to be achieved is
represented using logical models e.g Class
Diagrams. - They are not directly object-oriented
21Example Use case
- Creating New Diagrams
- Lets suppose the editor gives the user a
workspace within which one diagram can be
displayed at a time. - On creation of a new diagram this workspace is
empty (any existing diagrams are hidden - Users can choose which diagram to view form those
that are open
22Use-Case flow of Events
- For each use-case identified, a use-case flow of
events must be documented. This is a step by step
description starting with the actor that
initiated the use-case until the end of the
event. - This can be done in textual prose. Good practice
use a standard template for the creation of the
flow of events document - At first only the normal course of events are
described, but as analysis progresses, more
detail is added and alternative flows are added.
23Use-Case Flow of Events for Create Diagram
Use-Case
24Use-Case Flow of Events for Create New Rectangle
Use-Case
25Use-Case Flow of Events for Create New Graphical
Element Use-Case
- BUT isnt ellipse and line creation very similar
to rectangle - About identifying two points
- YES lets use a general version instead i.e.
Graphical Element
G. element
appropriate
G. element
G. element
G. element
26Use-Case Flow of Events for Create New Text
Element Use-Case
- This is different - but still has some common
events as create graphical element
- Create Element is a generalisation
- Create Graphical Element and Create Text Element
are specialisations of Create Element
27Example Use Case Select Element
28Example Use Case Delete Element
- Suppose the user selects an item, then presses a
delete button on the keyboard or toolbar - There is only a small bit of extra functionality
here
- Dashed arrow UML dependency
- ltltincludesgtgt label indicates the stereotype of
the dependency I.e. that Delete Element includes
the use case Select Element
29Example Use Case Moving an Element
- Moving an element has a lot of the functionality
of Select Element but does more - We can extend a use case
- The base use case Select Element must contain
an extension point indicating where the the Move
Element use case takes over and a condition
saying when it should be extended I.e. when the
user moves the mouse
30Full Use Case Diagram
31Generalisation between actors
- Suppose our diagram tool operates in a shared
environment and only Administrators can delete
elements
32Software Engineering
- Chapter Three
- Requirements Engineering
- Objectives
- Be able to define requirements engineering
- Be able to structure a requirements document
- Be able to write verifiable functional and
non-functional requirements - Be able to describe the evolution of requirements
- Be able to create UML use-case descriptions
- Be able to draw UML use-case diagrams