• No results found

Software Development. Chapter 7. Outline The Waterfall Model RISKS. Java By Abstraction Chapter 7

N/A
N/A
Protected

Academic year: 2021

Share "Software Development. Chapter 7. Outline The Waterfall Model RISKS. Java By Abstraction Chapter 7"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-1

Chapter 7

Software

Development

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-2

7.1 The Development Process

7.1.1

The Waterfall Model

7.1.2

The Iterative Methodology

7.1.3

Elements of UML

7.2 Software Testing

7.2.1

The Essence of Testing

7.2.2

The Test Vector

7.2.3

Debugging

7.3 Case Study

Outline

7.1.1 The Waterfall Model

REQUIREMENTS

DESIGN

IMPLEMENTATION

RISKS

• Architectural Risks

• Requirement Change Risks

• Assumptions Risks

In this model, all these risks get exposed

near

the end

of the waterfall. By then, it

(2)

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-5

RISKS

• Architectural Risks

• Requirement Change Risks

• Assumptions Risks

What’s is needed is:

Risk mitigation through

early exposure.

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-6

7.1.2 The Iterative Methodology

DEPLOY

START

DESIGN

REQUIREMENTS

TESTING

IMPLEMENTATION

EVALUATION

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-7

as a process

Iterative + Incremental

in use-cases

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-8

7.1.3 Elements of UML

type::lib::Fraction

This is a simple

Class Diagram

. It

is appropriate for early iterations

(3)

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-9

UML

A

Class Diagram

with more details.

type::lib::Fraction

+ isQuoted: boolean

+ separator: char

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-10

UML

A

Class Diagram

with still more details.

+ getNumerator(): long

+ setFraction(Fraction)

+ toString(): String

+ isQuoted: boolean

+ separator: char

type::lib::Fraction

+ isQuoted: boolean

+ separator: char

UML

B

Dependency: A uses B

Aggregation: A has a B

B

A

A

A

B

A Multi-class Application

CreditCard

GlobalCredit

App

(4)

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-13

7.2.1 The Essence of Testing

HARNESS

file

random

loop

input

SUITE

algorithm

verifica-tion

approxi-mation

file

ORACLE

UNIT

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-14

Example

1. A program that sorts a list of numbers in

non-descending order.

2. A program that determines if a given positive

integer is prime.

3. A program that finds the median of a set of an

odd number of numbers.

Describe an appropriate oracle for each of

the following scenarios:

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-15

7.2.2 The Test Vector

• Domain Coverage

Black-Box Testing

• Execution-Path Coverage

White-Box Testing

• Regression

The Bug-Recycling Phenomenon

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-16

7.2.3 Debugging

boolean containsDigits = false;

for (int i = 0; i < str.length(); i++)

{

char c = str.charAt(i);

containsDigits = Character.isDigit(c);

}

output.println(containsDigits);

Consider this digit detector:

(5)

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-17

Debugging

Testing Digit Detector:

Test Case

Output

"1234"

true

"F3O4"

true

"TEST"

false

"99MM"

false

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-18

Debugging

boolean containsDigits = false;

output.println("Test case: " + str);

for (int i = 0; i < str.length(); i++)

{

char c = str.charAt(i);

containsDigits = Character.isDigit(c);

output.println(i + " " + containsDigits);

}

output.println(containsDigits);

Debugging Digit Detector:

Debugging

Debugging Output:

99MM

0 true

1 true

2 false

Debugging

boolean containsDigits = false;

for (int i = 0; i < str.length(); i++)

{

char c = str.charAt(i);

containsDigits =

containDigits ||

Character…

}

output.println(containsDigits);

(6)

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-21

Debugging Techniques

• Print

, print, and then print

• Read

error messages

• Assert

your convictions

• Use a

debugger

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-22

Example

java.lang.StringIndexOutOfBoundsException:

String index out of range: -1

at

java.lang.String.substring(String.java:1438)

at

java.lang.String.substring(String.java:1411)

at Exercise_7.main(Exercise_7.java:15)

Exception in thread "main"

What does error message say?

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-23

7.3 Case Study

The Trajectory case study (Section 7.3)

demonstrates the iterative methodology.

In addition, it exposes the string

tokenizer class.

Here, we will explain string

tokenization

and outline a different case study: A

real-time

weather monitor

.

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-24

The StringTokenizer Class

• Resides in

java.util

• Useful for

parsing

:

- Sentences into words

- Records into fields

- Whenever delimiters are known

• Used for

interoperability

Spreadsheet, databases, …

Tab-delimited, CSV, …

(7)

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-25

The StringTokenizer API

• Two Constructors:

- String to parse

- String and delimiters

• nextToken()

*

• hasMoreTokens()

*

Overloaded: nextToken(delimiters)

Copyright © 2006 Pearson Education Canada Inc. Java By Abstraction 7-26

Example

StringTokenizer stk;

stk = new StringTokenizer(str);

for (String token = stk.nextToken();

stk.hasMoreTokens();

token = stk.nextToken())

{

...

}

What is wrong with this fragment?

Case Study

A Real-Time Weather Monitor

Write an app that monitors the weather in a

city and alerts you when the temperature

exceeds a certain value.

• Find a site that reports the current weather

• Note the site's URL when the city is selected

Additional Exercises

• Write an app that monitor the

price

of oil,

or gold, …

• Write an app that determines the current

CAD/USD

FX

rate.

References

Related documents

Initial integration costs are due to the effort needed to perform (1) candidate COTS component assessment, (2) COTS component tailoring, (3) the development and testing of

2-5 qualified concepts 1-3 concepts ready for feasibility study 3-7 outline concepts 3-6 qualified concepts Task 3 Develop criteria with Senior Mgmt Brief technical

Tibor Šimko Introduction Digital Library Invenio Case Studies Episode 1: Python Episode 2: Git Episode 3: Test Suite Episode 4: Building Efficient Indexes Episode 5:

In this section, we will briefly present (1) with the feature model for the SalesScenario case study and (2) with an excerpt of the overall project knowledge- base instantiated

Linberg performed a case study of a project group of 13 developers to explore three questions: (1) How do software developers define software development project success and

III.1 Software Engineering Life Cycle Models III.2 System Engineering Life Cycle Models III.3 Embedded System Life Cycle Models III.4 Advanced Life Cycle Models &amp; MDD III.5

o ETSI TS 102 870-1/2/3 V1.1.1– Testing; Conformance test specification for GeoNetworking basic transport protocol (BTP); Part 1; Part 2 and Part 3 Similarly like in

Minimum flow adjustment screw (Mb).. 3) How to test and adjust PQT control characteristics (1) Testing PQT control characteristics (see Fig. 7-6) Measure the flow caused by the