chapter 1 software engineering principles. problem analysis requirements elicitation software...

38
Chapter 1 Software Engineering Principles

Upload: tamsin-payne

Post on 17-Jan-2018

223 views

Category:

Documents


0 download

DESCRIPTION

CS Software Engineering Principles 3 Waterfall Model

TRANSCRIPT

Page 1: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

Chapter 1Software Engineering Principles

Page 2: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Problem analysis• Requirements elicitation• Software specification• High- and low-level design• Implementation• Testing and Verification• Delivery• Operation • Maintenance

CS 302 - Software Engineering Principles 2

The Software Life Cycle

Page 3: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 3

Waterfall Model

Page 4: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 4

Spiral Model

Page 5: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• A disciplined approach to the design, production, and maintenance of computer programs

• that are developed on time and within cost estimates,

• using tools that help to manage the size and complexity of the resulting software products

CS 302 - Software Engineering Principles 5

Software Engineering

Page 6: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• A logical sequence of discrete steps that describes a complete solution to a given problem computable in a finite amount of time

CS 302 - Software Engineering Principles 6

An Algorithm Is . . .

Page 7: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Hardware• the computers and their peripheral devices

• Software• operating systems, editors, compilers,

interpreters, debugging systems, test-data generators, and so on

• Ideaware• shared body of knowledge

CS 302 - Software Engineering Principles 7

Programmer ToolBoxes

Page 8: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• It works

• It can be modified without excessive time and effort

• It is reusable

• It is completed on time and within budget

CS 302 - Software Engineering Principles 8

Goals of Quality Software

Page 9: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Tells what the program must do, but not how it does it

• Is written documentation about the program

CS 302 - Software Engineering Principles 9

Detailed Program Specification

Page 10: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• A model of a complex system that includes only the details essential to the perspective of the viewer of the system

• Programs are abstractions

CS 302 - Software Engineering Principles 10

Abstraction

Page 11: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 11

Abstraction (cont.)

Page 12: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• The practice of hiding the details of a module with the goal of controlling access to the details from the rest of the system

• A programmer can concentrate on one module at a time

• Each module should have a single purpose or identity

CS 302 - Software Engineering Principles 12

Information Hiding

Page 13: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• A problem is approached in stages• Similar steps are followed during each stage,

with the only difference being the level of detail involved

• Some variations:• Top-down• Bottom-up• Functional decomposition• Round-trip gestalt design

CS 302 - Software Engineering Principles 13

Stepwise Refinement

Page 14: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 14

Visual Tools

Page 15: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 15

Visual Aids – CRC Cards

Page 16: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• “Read the specification of the software you want to build.

• Underline the verbs if you are after procedural code,

• the nouns if you aim for an object-oriented program.”

Grady Booch, “What is and isn’t Object Oriented Design,” 1989.

CS 302 - Software Engineering Principles 16

Procedural vs. Object-Oriented Code

Page 17: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

Divides the problem into more easily handled subtasks, until the functional modules (subproblems) can be coded

Identifies various objects composed of data and operations, that can be used together to solve the problem

PROCEDURALDECOMPOSITION

OBJECT-ORIENTED DESIGN

FOCUS ON: processes FOCUS ON: data objects

17CS 302 - Software Engineering Principles

Approaches to Building Manageable Modules

Page 18: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 18

Functional Design Modules

FindWeighted Average

PrintWeighted Average

Main

Print Data

Print Heading

Get DataPrepare File for Reading

Page 19: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• A technique for developing a program in which the solution is expressed in terms of objects• self- contained entities composed of data and

operations on that data

CS 302 - Software Engineering Principles 19

Object-Oriented Design

Private data

<<

setf...

Private data

>>

get...

ignore

cin cout

Page 20: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Testing: The process of executing a program with data sets

• Debugging: The process of removing known errors

• Acceptance Test: The process of testing the system in its real environment with real data

• Regression Testing: Reexecution of program tests after modifications have been made

Ensuring Software Correctness

CS 302 - Software Engineering Principles 20

Page 21: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 21

Verification vs. Validation

Program validation asks,“Are we doing the right job?”

Program verification asks,“Are we doing the job right?”

B.W. Boehm, Software Engineering Economics, 1981.

Page 22: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 22

Page 23: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Specification

• Design

• Coding

• Input

CS 302 - Software Engineering Principles 23

Types of Errors

Page 24: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 24

Cost of a Specification Error Based on When It Is Discovered

Page 25: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Robustness: The ability of a program to recover following an error;

• the ability of a program to continue to operate within its environment

• Preconditions: Assumptions that must be true on entry into an operation or function for the postconditions to be guaranteed

• Postconditions: Statements that describe what results are to be expected at the exit of an operation or function• assuming that the preconditions are true

CS 302 - Software Engineering Principles 25

Controlling Errors

Page 26: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Deskchecking: Tracing an execution of a design or program on paper

• Walk-through: A verification method in which a team performs a manual simulation of the program or design

• Inspection: A verification method in which one member of a team reads the program or design line by line and others point out errors

CS 302 - Software Engineering Principles 26

Design Review Activities

Page 27: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 27

Program Testing• Testing is the process of

executing a program with various data sets designed to discover errors.

Page 28: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• For Each Test Case: • determine inputs• determine the expected behavior of the

program• run the program and observe the resulting

behavior• compare the expected behavior and the actual

behavior

CS 302 - Software Engineering Principles 28

Program Testing (con't)

Page 29: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Unit testing: Testing a class or function by itself

• Black-box testing: Testing a program or function based on the possible input values, • treating the code as a “black box”

• Clear (white) box testing: Testing a program or function based on covering all of the branches or paths of the code

CS 302 - Software Engineering Principles 29

Types of Testing

Page 30: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

30CS 302 - Software Engineering Principles

Page 31: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

31CS 302 - Software Engineering Principles

Page 32: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Is performed to integrate program modules that have already been independently unit tested.

CS 302 - Software Engineering Principles 32

Integration Testing

FindWeighted Average

PrintWeighted Average

Main

Print Data

Print Heading

Get DataPrepare File for Reading

Page 33: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

Integration Testing Approaches

CS 302 - Software Engineering Principles 33

Ensures correct overall design logic.

Ensures individual moduleswork together correctly, beginning with the lowest level.

TOP-DOWN BOTTOM-UP

USES: placeholder USES: a test driver to callmodule “stubs” to test the functions being tested.the order of calls.

Page 34: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• Document showing the test cases planned for a program or module, their purposes, inputs, expected outputs, and criteria for success

• For program testing to be effective, it must be planned

• Start planning for testing before writing a single line of code

CS 302 - Software Engineering Principles 34

Test Plans

Page 35: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 35

Testing C++ Structures

Page 36: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

Declare an instance of the class being testedGet name and open input fileGet name and open output fileGet label for the output fileWrite the label on the output fileRead the next command from the input fileSet numCommands to 0While the command read is not ‘quit’

Execute member function of the same name Print the results to the output file

Increment numCommands by 1Print “Command number” numComands “completed” to the screen

Read the next command from the input fileClose the input and output files.Print “Testing completed” to the screen

36CS 302 - Software Engineering Principles

Page 37: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

CS 302 - Software Engineering Principles 37

Life-Cycle Verification Activities

Page 38: Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation

• When a stream enters the fail state, further I/O operations using that stream are ignored. • But the computer does not automatically halt the

program or give any error message. • Possible reasons for entering fail state

include: • invalid input data (often the wrong type)• opening an input file that does not exist• opening an output file on a disk that is already full

or is write-protected.

CS 302 - Software Engineering Principles 38

Stream Failure