the software development process -- iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · –...

27
Java Software Solutions Lewis and Loftus Chapter 11 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. The Software Development Process -- In • The quality of the software we create is a the process we follow to develop it • Chapter 11 focuses on: – software life cycle – development models – prototypes – robot search problem

Upload: hoangcong

Post on 05-Mar-2018

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

1

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

The Software Development Process -- In

•The quality of the software we create is a d

the process we follow to develop it

•Chapter 11 focuses on:

–software life cycle

–development models

–prototypes

–robot search problem

Page 2: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

2

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

The Program Life Cycle

•The overall life of a program includes use a

maintenance:

Use

Development

Maintenance

Page 3: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

3

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Maintenance

•Maintenance tasks include any modifications

existing program

•It includes defect removal and enhancements

•The characteristics of a program that make i

develop also make it easy to maintain

•Maintenance efforts tend to far outweigh the

development effort in today’s software

•Small increases in effort at the development

greatly reduce maintenance tasks

Page 4: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

4

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Development vs. Maintenance

Use and

Maintenance

Development

Page 5: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

5

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Development and Maintenance Effort

Development

Maintenance

Development Maintenance

Page 6: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

6

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Development Process Models

•Too many programmers follow a build-and-fix

approach

•They write a program and modify it until it

without regard to system design

•Errors are haphazardly addressed as they are

•It is not really a development model at all

Page 7: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

7

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

The Build-and-Fix Approach

Write

program

Modify

program

Page 8: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

8

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

The Waterfall Model

•Developed in the mid 1970s

•Activities that must be specifically address

development include:

–Establishing clear and unambiguous requirements

–Creating a clean design from the requirements

–Implementing the design

–Testing the implementation

•Originally it was proposed as a linear model

or no backtracking

•It is a nice goal, but unrealistic

Page 9: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

9

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

The Waterfall Model

Establish

requirements

Create

design

Implement

code

Test

system

Page 10: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

10

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

An Iterative Process

•Allows the developer to cycle through the di

development stages

•Essentially the waterfall model with backtra

•However backtracking should not be used as a

•It should be used as a technique available t

developer in order to deal with unexpected p

may arise in later stages of development

Page 11: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

11

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

An Iterative Development Process

Establish

requirements

Create

design

Implement

code

Test

system

Page 12: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

12

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Prototype

•A program created to explore a particular co

•More useful, time-effective, and cost-effect

merely acting on an assumption that may late

•Usually created to communicate to the client

–a particular task

–the feasibility of a requirement

–a user interface

•A way of validating requirements

Page 13: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

13

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

An Enhanced Iterative Model

Establish

requirements

Create

design

Implement

code

Test

system

Prototype

Prototype

Prototype

Prototype

Evaluate

Evaluate

Evaluate

Evaluate

Page 14: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

14

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Evaluation

•The results of each stage should be evaluate

prior to going on to the next stage

•Before moving on to the design, for example,

requirements should be evaluated to ensure

completeness, consistency, and clarity

•A design evaluation should ensure that each

was adequately addressed

•Prior to testing, the implementation should

thorough

code walkthrough

Page 15: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

15

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Testing Techniques

•Goal: to find errors

•Called

defect testing

•A good test will uncover problems in a progr

•A test case includes

–a set of inputs

–user actions or other initial conditions

–expected output

•It is not feasible to exhaust every possible

Page 16: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

16

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Black-Box Testing

•Mapping a set of specific inputs to a set of

outputs

•An equivalence category is a collection of i

•Two input sets belong to the same equivalenc

if there is no reason to believe that if one

other will not

•Therefore testing one input set essentially

category

Page 17: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

17

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

White-Box Testing

•Also referred to as glass-box testing

•Focuses on the internal logic such as the im

of a method

•Statement coverage guarantees that all state

method are executed

•Condition coverage guarantes that all paths

method are executed

Page 18: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

18

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Robot Search Simulator

•We’ll now explore a large example and follow

the various development activities

•Robot Search Problem

–a robot is sent into a hazardous area to find a ta

–we must develop a simulator to test its search alg

–the results will be shown graphically

–walls and other barriers must be taken into accoun

Page 19: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

19

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Robot Search Requirements

•The robotic engineers provide an initial set

requirements

•The initial set are unclear and leave many q

unanswered

•The developers interview the engineers to re

and create a new version of the requirements

•They are reviewed and critiqued

Page 20: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

20

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Robot Search Design

•The design itself should be an iterative pro

•An initial set of objects is chosen based on

requirements

•As the design develops the apparent need for

objects arises

•Objects are abstracted into classes

•Focus is on the overall structure of the pro

Page 21: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

21

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Robot Search Design

•Initial classes:

Robot

move ()

draw ()

Goal

draw ()

Obstacle

draw ()

Page 22: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

22

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

A Class Hierarchy for Robots

Robot

Random_Robot

Diagonal_RobotSpiral_Robot

Vertical_Robot

Page 23: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

23

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

A Scenario Diagram

Robot_Sim

Random_Robot

Goal

Obstacle

1: detect_goal()

3: move()

2: collision()

4: collision()

Page 24: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

24

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Changing Robot Position

1, 1

1, 0

0, 1

1, -1

-1, 1

-1, 0

0, -1

-1, -1

Page 25: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

25

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Robot Search Design

•The developers have only limited knowledge o

processing

•A prototype is developed to:

–load an image

–move it across the screen

–test animation speeds

•This is called a proof-of-concept prototype,

developers continue with confidence

Page 26: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

26

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Robot Search Implementation

•The classes of the design are implemented in

files:

–Robot_Sim.java

–Robot.java

–Diagonal_Robot.java

–Goal.java

–Obstacle.java

•Each one contains a particular class or clas

Page 27: The Software Development Process -- Iwebhome.cs.uvic.ca/~hausi/110/book/pdf/chap11.pdf · – Testing the implementation – • Originally it was proposed as a linear mod el or no

Java Software Solutions Lewis and Loftus

Chapter 11

27

Copyright 1997 by John Lewis and William Loftus. All rights reserved.

Collision Detection

Obstacle