Requirements Engineering - LiU

47
Software Engineering Theory Requirements Engineering Kristian Sandahl / Lena Buffoni Department of Computer and Information Science

Transcript of Requirements Engineering - LiU

Page 1: Requirements Engineering - LiU

Software Engineering Theory

Requirements Engineering

Kristian Sandahl / Lena BuffoniDepartment of Computer and Information Science

Page 2: Requirements Engineering - LiU

What is a software requirement? 2

• Intuitively:

– A property or behaviour we want from a system

• More formally:

– “Software requirements express the needs and constraints placed on a software product that contribute to the solution of some real-world problems.”

(Kotonya and Sommerville, 2000)– “A requirement is something the product must do

or a quality it must have.”(Suzanne & James Robertson, 2006)

Page 3: Requirements Engineering - LiU

Examples

MARCH 24, 2017 3Title/Lecturer

Web shop:

– When the user enters type of T-shirt, the system shall show a palette of available colors.

LIU Intranet:

– A password must contain a combination of literals and numerals and be at least 8 characters long

Car simulator:

- The feel of the brakes must be realistic

Page 4: Requirements Engineering - LiU

Why are Requirements Important?

4

• Requirements Engineering is an important part of the early phases in system design

• Errors in system requirements cause large cost increase in product development, or even completely failed projects

Page 5: Requirements Engineering - LiU

How do you write a natural language requirement?

5

• To avoid misunderstandings, always use a complete sentence.

• A sentence expresses a complete thought and consists of a subject and a predicate.

• Use modal verbs: ”shall”, ”will”, and ”must”

• Don’t use: ”should”, ”would”, or ”might”

• Be careful with quantifiers “all”, “never”, “each”

“Timely review should be done as soon as possible, and shall not exceed two working weeks.” (TS/ISO 16949)

Page 6: Requirements Engineering - LiU

Functional requirements 6

• Describe the behaviour or features of a software.

• Can be tested by giving input and checking the output.

• Example: “The user shall be able to add an item to the shopping basket.”

Page 7: Requirements Engineering - LiU

Functional requirements 7

• Think of the mathematical definition:

a function is a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output.

f(x)=ySave document on exit function

{yes, no}

Result

f(yes) = document savedf(no) = changes discarded

Page 8: Requirements Engineering - LiU

Non-functional requirements

8

• Design constraints, limiting the solution space

– Example: “The system shall be implemented in php.”

• Quality requirements, possible to measure

– Example: “The minimum response time is 2.0 seconds”

Page 9: Requirements Engineering - LiU

Other domains for non functional requirements

MARCH 24, 2017 9Title/Lecturer

• Scalability

• Reliability

• Security and encryption

• Environmental

• Maintainability

• Usability

Not all easily verifiable!

Page 10: Requirements Engineering - LiU

User interface requirements

MARCH 24, 2017 10Title/Lecturer

• An integral part of most applications now and often a major selling point for the customer

– easy to operate

– quick in response

– effectively handling operational errors

– simple yet consistent user interface

– user-centric

Ok. Go into menu

SettingsPreferencesAdvanced

Double click the square

Jump 3 times on one foot….

Page 11: Requirements Engineering - LiU

11

Features• A distinguishing characteristic of a system item (includes both

functional and nonfunctional attributes such as performance and reusability).

(IEEE Std 829)Higher level stuff, used in advertising: “The system shall have an SMS delivery notification service.”

R1: The user phone number shallbe pretty-printed in the format:07x – xxx xx xx

R2: The delivery tracking system shall interface the DHL system.

R3: The user shall be notifiedat maximum 30 minutes afterarrival to the pick-up point.

Page 12: Requirements Engineering - LiU

Organize the Software Requirement Specification (SRS)12

• Example from IEEE Std 830-19983.2 Functional requirements3.2.1 Show colors

When the user enters type of T-shirt, the system shall show a palette of available colours.

3.2.2 Add to shopping basketThe user shall be able to add an item to the shopping basket.

3.3 Performance requirements3.3.1 Response time

The minimum response time is 2.0 seconds.3.4 Design constraints

The system shall be implemented in php.

Page 13: Requirements Engineering - LiU

If a more thorough description is needed 13

3.2.1 Show colors

3.2.1.1 Input variables

Type of T-shirt

3.2.1.2 Output variables

Set of color codes

3.2.1.3 Processing

1. Query database for available colors of Type of T-shirt.

2. Create a set of color codes.

3. Send color codes to palette viewer

Page 14: Requirements Engineering - LiU

Alternative ways of organizing requirements 14

3.2 System features

3.2.1 SMS notification

3.2.1.1 Purpose of SMS notification

The system shall have an SMS delivery notification service so customers can collect their delivery as fast as possible.

3.2.1.2 Stimulus/response sequence

When the delivery is has arrived to the pick-up point, notify the user.

3.2.1.3 Associated functional requirements

3.2.1.3.1 Number format

The user phone number shall be pretty-printed in the format:07x – xxx xx xx

3.2.1.3.2 Change number

…..

Page 15: Requirements Engineering - LiU

SRS contents IEEE Std 830-1998 15

1 Introduction

1.1 Purpose

1.2 Scope

1.3 Definitions, acronyms and abbreviations

1.4 References

1.5 Overview

4 Supporting information4.1 Index4.2 Appendices

2 Overall description2.1 Product perspective2.2 Product functions2.3 User characteristics2.4 General constraints2.5 Assumptions and dependencies2.6 Lower ambition levels

3 Specific requirements3.1 Interface requirements

3.1.1 User interfaces3.1.2 Hardware interfaces3.1.3 Software interfaces3.1.4 Communication interfaces

3.2 Functional requirements3.3 Performance requirements3.4 Design constraints3.5 Software system attributes3.6 Other requirements

Page 16: Requirements Engineering - LiU

SRS contents IEEE Std 830-1998 16

1 Introduction

1.1 Purpose

1.2 Scope

1.3 Definitions, acronyms and abbreviations

1.4 References

1.5 Overview

2 Overall description2.1 Product perspective2.2 Product functions2.3 User characteristics2.4 General constraints2.5 Assumptions and dependencies2.6 Lower ambition levels

•Describe purpose of this SRS•Describe intended audience

•Identify the software product•Enumerate what the system will and will not do•Describe user classes and benefits for each

•Define the vocabulary of the SRS (may reference appendix)

•List all referenced documents including sources(e.g., Use Case Model and Problem Statement; Experts in the field)

•Describe the content of the rest of the SRS•Describe how the SRS is organized

Page 17: Requirements Engineering - LiU

SRS contents IEEE Std 830-1998 17

1 Introduction

1.1 Purpose

1.2 Scope

1.3 Definitions, acronyms and abbreviations

1.4 References

1.5 Overview

2 Overall description2.1 Product perspective2.2 Product functions2.3 User characteristics2.4 General constraints2.5 Assumptions and dependencies2.6 Lower ambition levels

•Present the business case and operational concept of the system•Describe how the proposed system fits into the business context•Describe external interfaces: system, user, hardware, software, communication•Describe constraints: memory, operational, site adaptation

•Describe and justify technical skills and capabilities of each user class

•Summarize the major functional capabilities•Include the Use Case Diagram and supporting narrative(identify actors and use cases)•Include Data Flow Diagram if appropriate

•Describe other constraints that will limit developer’s options; e.g., regulatory policies; target platform, database, network software and protocols, development standards requirements

Page 18: Requirements Engineering - LiU

SRS contents IEEE Std 830-1998 18

1 Introduction

1.1 Purpose

1.2 Scope

1.3 Definitions, acronyms and abbreviations

1.4 References

1.5 Overview

4 Supporting information4.1 Index4.2 Appendices

2 Overall description2.1 Product perspective2.2 Product functions2.3 User characteristics2.4 General constraints2.5 Assumptions and dependencies2.6 Lower ambition levels

3 Specific requirements3.1 Interface requirements

3.1.1 User interfaces3.1.2 Hardware interfaces3.1.3 Software interfaces3.1.4 Communication interfaces

3.2 Functional requirements3.3 Performance requirements3.4 Design constraints3.5 Software system attributes3.6 Other requirements

Page 19: Requirements Engineering - LiU

Pros and cons of IEEE 830

19

Cons

• Takes some time to read and understand

• Very general, needs to be tailored

• Is no guarantee for a good SRS

Pros• Good checklist• Many ways to adapt

organization• Many ways to detail

requirements• You don’t need to have

everything in

Page 20: Requirements Engineering - LiU

Requirements specification

20

Requirements in a good SRS are:

• Numbered

• Inspected

• Prioritised

• Unambiguous

• Testable

• Complete

• Consistent

• Traceable• Feasible• Modifiable• Useful for:

– operation– maintenance– customer– developer– ….

Who is the reader?

Page 21: Requirements Engineering - LiU

21

Iterative processCollect user requirements

Document/build

Check that it matchesuser/customer requirements

Elicitation

Analysis

Speci-fication

Validattion Understand

Page 22: Requirements Engineering - LiU

22Elicitation

Purpose:– Understand the true needs of the customer– Trace future implementation to needs

Sources:– Goals– Domain knowledge– Stakeholders– Environment

Carolthe customer Robert

the requirements engineer

needs needs

Techniques:• Interviews• Scenarios• Prototypes• Facilitated meetings• Observation

Page 23: Requirements Engineering - LiU

Interviews

23

Process:

• Start

• Q & A

• Summary teach-back

• Thank you!

• What’s next

Kinds:

• Structured

• Unstructured

Tips:

• Be 2 interviewers – shift roles• Plan the interview• Don’t stick to the plan – use

feelings• Let the customer talk• Alternate between open-ended

and yes/no questions• Prepare ice-breakers• Probe thinking• Look for body language• Think of human bias• Why do you get the answers you

get?

Page 24: Requirements Engineering - LiU

Elicitation 24

“If I’d asked my customers what they wanted, they’d have said a faster horse.”

Henry Ford

Page 25: Requirements Engineering - LiU

Prototyping

MARCH 24, 2017 25Title/Lecturer

• Consistent with requirement specification

• Clear scope

• Provide and execute a test scenario

• Minimize throwaway code

Page 26: Requirements Engineering - LiU

Requirements analysis goals 26

• Detect and resolve conflicts between requirements

• Discover bounds of software

• Define interaction with the environment

• Elaborate high-level requirements to derive detailed requirements

• Classify requirements for more effective management

Elicitation

Analysis

Speci-fication

Validattion

Often accomplished with conceptual modelling

Page 27: Requirements Engineering - LiU

Requirements classification

27

• Functional vs non-functional requirements

• Source

• Product or process requirements

• Priority

• Scope in terms of affected components

• Volatility vs stability

Page 28: Requirements Engineering - LiU

Conceptual Modelling

28

• Representation in semi-formal notation

• Often diagrammatic representation

• Examples:

– Object-orientation, use-cases, state-machines

– Activity diagrams

– Data flow diagrams

– Entity-relationship models

Page 29: Requirements Engineering - LiU

Use-case modelling

29

A use-case is:“… a particular form or pattern or exemplar of usage, a scenario that begins with some user of the system initiating some transaction of sequence of interrelated events.”Jacobson, m fl 1992: Object-oriented software engineering. Addison-Wesley

Page 30: Requirements Engineering - LiU

30

Use-case diagram of a single use-case

• A Coffee Drinker approaches the machinewith his cup and a coin of SEK 5.

• He places the cup on the shelf just under thepipe.

• He then inserts the coin, and pressesthe button for coffee to get coffee according to default settings.

• Optionally he might use other buttons to adjust the strength and decide to add sugar and/or whitener.

• The machine processes the coffee and bell when it is ready.

• The Coffee Drinker takes his cup from the shelf.

Page 31: Requirements Engineering - LiU

31

Use-case diagram of a single use-case

Buy a cup of coffee

CoffeeDrinkerA CoffeeDrinker approaches the machinewith his cup and a coin of SEK 5. Heplaces the cup on the shelf just under thepipe. He then inserts the coin, and pressesthe button for coffee to get coffee according to default settings. Optionallyhe might use other buttons to adjust the strength and decide to add sugar and/or whitener. The machine processes the coffee and bell when it is ready. The CoffeeDrinker takes his cup from the shelf.

Actor: a user of the system in aparticular role.Can be human or system.

Description of use-case

AssociationUse-case

Use-case name(verb phrase)

Page 32: Requirements Engineering - LiU

32

Use-case diagram for the coffee-machine

CoffeDrinker

TeaDrinker

Service

Porter

Buy a cup ofcoffe

Get coin inreturn

Pour hot water

Clean theMachine

Brew a can of coffee

CoffeeMachine

Add ingredients

Collect coins

Subjectboundary

Subject Subjectname

Page 33: Requirements Engineering - LiU

Relations between use-cases

Extend loan

Borrow copy of book

Check for reservation

<<include>>

<<include>>BookBorrower

Refuse loan <<extend>>

Stereotype: extendedclassification of meaning

”Separating scenarios”

”Reuse”

Page 34: Requirements Engineering - LiU

34

Identifying classes: noun analysis

•machine – real noun handled by the system

•cup – unit for beverage

•coin – detail of user and machine

•shelf – detail of machine

•pipe – detail of machine

•button– handled by the system

•sugar – detail of coffee

•whitener – detail of coffee

•cup of coffee – handled by the system

•indicator – not discovered

A CoffeeDrinker approaches the machinewith his cup and a coin of SEK 5. Heplaces the cup on the shelf just under thepipe. He then inserts the coin, and pressthe button for coffee to get coffee according to default settings. Optionallyhe might use other buttons to adjust the strength and decide to add sugar and/or whitener. The machine processes the coffee and bell when it is ready. The CoffeeDrinker takes his cup from the shelf.

Page 35: Requirements Engineering - LiU

35

The coffee machine class model

CoffeeCustomer

Porter

CupOfCoffee

CanOfCoffee

buys

byus

0..1

0..1

0..*

0..*

makes machine

11

1 111

10..*

Interface CoinHandler Brewer

Page 36: Requirements Engineering - LiU

36

Data model: ER-diagram

Student

Course

NamePersonal numberCurriculum

Enrolled-in

SubjectCourse codeMax-enrolment

Page 37: Requirements Engineering - LiU

37

Specification

• There is no perfect specification, but you can write a good one• The RS, or SRS avoids many misunderstandings• The RS is of special importance in outsourcing programming

Carolthe customer

Robert the requirements engineer

needs needs

SRS

Elicitation

Analysis

Speci-fication

Validattion

Page 38: Requirements Engineering - LiU

38

User stories – lightweight alternative

As a (role) I want (something) so that (benefit)

See more at: http://www.agilemodeling.com/artifacts/userStory.htm

As a student I want to buy a parking card so that I can drive the car to school.

Priority: 3Estimate: 4

Good for:• Smaller (sub-)projects• Frequent releases• User feed-back• Prototyping• Elicitation• Functional requirements

Page 39: Requirements Engineering - LiU

Means of validation 39

• Prototyping

• Simulation

• Software Reviews

• Model checking

• Formal proofs

• Acceptance testing

Elicitation

Analysis

Speci-fication

Validattion

Traceability is key to validation!

Page 40: Requirements Engineering - LiU

40The role of requirements in the life-cycle

time

specification

fuzziness

elicitation

modelling formalisation

Carolthe customer

Dianathe developer

Timthe tester

Page 41: Requirements Engineering - LiU

41

Quality factors• Correctness• Reliability• Efficiency• Usability• Integrity• Maintainability• Flexibility• Testability• Security

• Portability• Reusability• Interoperability• Survivability• Safety• Manageability• Supportability• Replaceability• Functionality

Cost?

Trade-offs?

Priorities?

Page 42: Requirements Engineering - LiU

Usability and Security 42

Page 43: Requirements Engineering - LiU

43Usability Engineering

Evaluate goals of• Relevance• Efficiency• Attitude• Learnability

• Methods: automated /non-automated

Iterative Process

Risk

Maturation / Knowledge

Time

Page 44: Requirements Engineering - LiU

Reliability

44

• The probability that the software executes with no failures during a specified time interval

• Approximation: MTTF/(1+MTTF)

• Easier to manage: Failure intensity, [failures / hours of execution time]

• Another approximation: λ = (1-R)/t

Page 45: Requirements Engineering - LiU

45Failure intensity guideline

Impact Failure intensity Time btwn failures

Hundreds of deaths, $109 cost

10-9 114 000 years

1-2 deaths, $106 cost 10-6 114 years

$1000 cost 10-3 6 weeks

$100 cost 10-2 100 h

$10 cost 10-1 10 h

$1 cost 1 1 h

Page 46: Requirements Engineering - LiU

Things to keep an eye on46

Human bias:

– We tend to be more detailed in areas where we already have good knowledge.

Deleted requirements:

– The more we invest in working with requirements, the more we lose when they are deleted

P(change)Benefitof detail

Page 47: Requirements Engineering - LiU

www.liu.se

www.liu.se