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

Requirements EngineeringTDDC88/theory/03requirements.… ·  · 2017-09-04Software Engineering Theory. Requirements Engineering. ... Maintenance. Realization. ... • Structured

  • Upload
    ngothu

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Software Engineering Theory

Requirements Engineering

Kristian Sandahl / Lena BuffoniDepartment of Computer and Information Science

Requirements assignment

SEPTEMBER 4, 2017

2

• Solve the problems by reading and reflecting about the concepts introduced today and on Friday.

• Submit before the deadline according to instructions on the homepage.

• You may work in groups of 1-2 people

• You may get 0-4 bonus credits for the written exam

• Make sure to avoid plagiarism, run http://noplagiat.bibl.liu.se/default.en.asp

SEPTEMBER 4, 2017

3

Requirement formalization in product life-cycle

Specification

Design

DesignRefinement

Component verification

Subsystem level integration andverification

Subsystem level integration testcalibration and verification

Product verification anddeployment

Maintenance

Realization

Detailed feature design andimplementation

Architectural design and system functional design

Preliminary feature design

Systemrequirements

Level of Abstraction

Documentation, Version and Configuration Management

Verification

Integration

Calibration

Experience Feedback

What is a software requirement? 4

• 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)

Examples

SEPTEMBER 4, 2017

5

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

Why are Requirements Important?

6

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

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

How do you write a natural language requirement?

7

• 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)

Functional requirements8

• 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.”

• 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)=y

Non-functional requirements

9

• 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”

Other domains for non functional requirements

SEPTEMBER 4, 2017

10

• Scalability

• Reliability

• Security and encryption

• Environmental

• Maintainability

• Usability

Not all easily verifiable!

User interface requirements

SEPTEMBER 4, 2017

11

• 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….

12

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.

Organize the Software Requirement Specification13

• 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.

If a more thorough description is needed 14

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

Alternative ways of organizing requirements 15

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

…..

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

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

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

•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

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

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

SRS contents IEEE Std 830-1998 19

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

Pros and cons of IEEE 830

20

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

Requirements specification

21

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?

R51: A car that feels more comfortable than the previous

version

22

Iterative processCollect user requirements

Document/build

Check that it matchesuser/customer requirements

Elicitation

Analysis

Speci-fication

Validattion Understand

23Elicitation

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

Interviews

24

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?

Elicitation 25

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

Henry Ford

Prototyping

SEPTEMBER 4, 2017

26

• Consistent with requirement specification

• Clear scope

• Provide and execute a test scenario

• Minimize throwaway code

Requirements analysis goals 27

• 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

Validation

Often accomplished with conceptual modelling

Requirements classification

28

• Functional vs non-functional requirements

• Source

• Product or process requirements

• Priority

• Scope in terms of affected components

• Volatility vs stability

Requirement prioritizationSEPTEMBER 4,

201729

• Different prioritization strategies

(numerical, categories, 100 dollar method, …)

• Identify and order priorities for trade-off requirements

– Eg: I want a fast web-site with high resolution graphics

• Good ratio between different priorities – all requirements cannot be critical

• Cost, technical-risk, time frames are all considerations in prioritizing

• Low priority requirements are not a maybe/someday wish-list!

Requirements Abstraction Model

Utilizing several levels of abstraction

A structured way of working

Source: Tony Gorschek, BTH

Up to product level and down to function level

RAM - Action Steps

Specify(elicit)

Place(evaluate)

Abstraction(work-up)

REQUIREMENTS

Conceptual Modelling

32

• Representation in semi-formal notation

• Often diagrammatic representation

• Examples:

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

– Activity diagrams

– Data flow diagrams

– Entity-relationship models

Use-case modelling

33

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

34

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)

35

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

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”

37

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.

38

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

39

Data model: ER-diagram

Student

Course

NamePersonal numberCurriculum

Enrolled-in

SubjectCourse codeMax-enrolment

Tips for writing good use cases

SEPTEMBER 4, 2017

40

• Start by identifying the list of actors

– remember systems can be actors too, eg: PayPal

– be consistent with the breakdown

• Describe “sunny day” use cases

• Use them to produce “rainy-day” use-cases

• Agile-workflow? Iterate on the use-cases

41

Specification

• There is no perfect specification, but you can write a good one• The Requirement Specification (RS), or SRS (Software RS) 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

42

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

Means of validation 43

• Prototyping

• Simulation

• Software Reviews

• Model checking

• Formal proofs

• Acceptance testing

Elicitation

Analysis

Speci-fication

Validation

Traceability is key to validation!

44The role of requirements in the life-cycle

time

specification

fuzziness

elicitation

modelling formalisation

Carolthe customer

Dianathe developer

Timthe tester

Iterative process

SEPTEMBER 4, 2017

45

• The requirement specification is a living document

• Priorities change

• Technical issues can lead to modifications

• Some requirements may need

additional elicitationGreat job! Can you just redo it

in midnight blue?

46

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

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

Cost?

Trade-offs?

Priorities?

Usability and Security 47

48Usability Engineering

Evaluate goals of• Relevance• Efficiency• Attitude• Learnability

• Methods: automated /non-automated

Iterative Process

Risk

Maturation / Knowledge

Time

Reliability

49

• 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

50Failure 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

51Why do we need requirements?Useful for:• Design• Test• Support• Planning• Maintenance

Communication to stakeholders

Contract document

Resolve conflicts

Finding true needs

Make trade-offs

Elucidate grey areas

Things to keep an eye on52

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

www.liu.se

www.liu.se