chapter 10: software engineering presentation slides for java software solutions foundations of...

26
Chapter 10: Software Chapter 10: Software Engineering Engineering Presentation slides for Presentation slides for Java Software Solutions Java Software Solutions Foundations of Program Design Foundations of Program Design Second Edition Second Edition by John Lewis and William Loftus by John Lewis and William Loftus Java Software Solutions is published by Addison-Wesley Java Software Solutions is published by Addison-Wesley Presentation slides are copyright 2000 by John Lewis and William Loftus. All rights reserved. Presentation slides are copyright 2000 by John Lewis and William Loftus. All rights reserved. Instructors using the textbook may use and modify these slides for pedagogical purposes. Instructors using the textbook may use and modify these slides for pedagogical purposes.

Post on 20-Dec-2015

219 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

Chapter 10: Software Chapter 10: Software Engineering Engineering

Presentation slides forPresentation slides for

Java Software SolutionsJava Software SolutionsFoundations of Program DesignFoundations of Program Design

Second EditionSecond Edition

by John Lewis and William Loftusby John Lewis and William Loftus

Java Software Solutions is published by Addison-WesleyJava Software Solutions is published by Addison-Wesley

Presentation slides are copyright 2000 by John Lewis and William Loftus. All rights reserved.Presentation slides are copyright 2000 by John Lewis and William Loftus. All rights reserved.

Instructors using the textbook may use and modify these slides for pedagogical purposes.Instructors using the textbook may use and modify these slides for pedagogical purposes.

Page 2: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

2

Software EngineeringSoftware Engineering

The quality of the software we create is a direct result of The quality of the software we create is a direct result of the process we follow to develop itthe process we follow to develop it

Chapter 10 focuses on:Chapter 10 focuses on:• software development modelssoftware development models

• the software life cyclethe software life cycle

• linear and iterative development approacheslinear and iterative development approaches

• an evolutionary approach to object-oriented developmentan evolutionary approach to object-oriented development

Page 3: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

3

The Program Life CycleThe Program Life Cycle

The overall The overall life cyclelife cycle of a program includes use and of a program includes use and maintenance:maintenance:

UseDevelopment

Maintenance

Page 4: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

4

MaintenanceMaintenance

MaintenanceMaintenance tasks include any modifications to an existing tasks include any modifications to an existing programprogram

It includes defect removal and enhancementsIt includes defect removal and enhancements

The characteristics of a program that make it easy to The characteristics of a program that make it easy to develop also make it easy to maintaindevelop also make it easy to maintain

Maintenance efforts tend to far outweigh the development Maintenance efforts tend to far outweigh the development effort in today’s softwareeffort in today’s software

Small increases in effort at the development stage can Small increases in effort at the development stage can greatly reduce maintenance tasksgreatly reduce maintenance tasks

Page 5: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

5

Development vs. MaintenanceDevelopment vs. Maintenance

Use andMaintenance

Development

Page 6: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

6

Development and Maintenance Development and Maintenance EffortEffort

Development Maintenance

Development Maintenance

Small increases in development effort canSmall increases in development effort canreduce maintenance effortreduce maintenance effort

Page 7: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

7

Development Process ModelsDevelopment Process Models

Too many programmers follow a Too many programmers follow a build-and-fixbuild-and-fix approach approach

They write a program and modify it until it is functional, They write a program and modify it until it is functional, without regard to system designwithout regard to system design

Errors are haphazardly addressed as they are discoveredErrors are haphazardly addressed as they are discovered

It is not really a development model at allIt is not really a development model at all

Page 8: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

8

The Build-and-Fix ApproachThe Build-and-Fix Approach

Writeprogram

Modifyprogram

Page 9: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

9

The Waterfall ModelThe Waterfall Model

The The waterfall modelwaterfall model was developed in the mid 1970s was developed in the mid 1970s

Activities that must be specifically addressed during Activities that must be specifically addressed during development include:development include:• Establishing clear and unambiguous requirementsEstablishing clear and unambiguous requirements

• Creating a clean design from the requirementsCreating a clean design from the requirements

• Implementing the designImplementing the design

• Testing the implementationTesting the implementation

Originally it was proposed as a linear model, with little or Originally it was proposed as a linear model, with little or no backtrackingno backtracking

It is a nice goal, but is generally unrealisticIt is a nice goal, but is generally unrealistic

Page 10: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

10

The Waterfall ModelThe Waterfall Model

Establish requirements

Create design

Implement code

Test system

Page 11: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

11

An Iterative ProcessAn Iterative Process

Allows the developer to cycle through the different Allows the developer to cycle through the different development stagesdevelopment stages

Essentially the waterfall model with backtrackingEssentially the waterfall model with backtracking

However backtracking should not be used irresponsiblyHowever backtracking should not be used irresponsibly

It should be used as a technique available to the developer It should be used as a technique available to the developer in order to deal with unexpected problems that may arise in order to deal with unexpected problems that may arise in later stages of developmentin later stages of development

Page 12: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

12

An Iterative Development An Iterative Development ProcessProcess

Establishrequirements

Createdesign

Implementcode

Testsystem

Page 13: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

13

PrototypePrototype

A prototype is a program created to explore a particular A prototype is a program created to explore a particular conceptconcept

More useful, time-effective, and cost-effective than merely More useful, time-effective, and cost-effective than merely acting on an assumption that may later backfireacting on an assumption that may later backfire

Usually created to communicate to the client:Usually created to communicate to the client:• a particular taska particular task

• the feasibility of a requirementthe feasibility of a requirement

• a user interfacea user interface

A way of validating requirementsA way of validating requirements

Page 14: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

14

EvaluationEvaluation

The results of each stage should be evaluated carefully The results of each stage should be evaluated carefully prior to going on to the next stageprior to going on to the next stage

Before moving on to the design, for example, the Before moving on to the design, for example, the requirements should be evaluated to ensure completeness, requirements should be evaluated to ensure completeness, consistency, and clarityconsistency, and clarity

A design evaluation should ensure that each requirement A design evaluation should ensure that each requirement was adequately addressedwas adequately addressed

Prior to testing, the implementation should be give a Prior to testing, the implementation should be give a thorough thorough code walkthroughcode walkthrough

Page 15: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

15

Testing TechniquesTesting Techniques

Generally, the goal of testing is to find errorsGenerally, the goal of testing is to find errors

It is often called It is often called defect testingdefect testing

A good test will uncover problems in a programA good test will uncover problems in a program

A A test casetest case includes includes• a set of inputsa set of inputs

• user actions or other initial conditionsuser actions or other initial conditions

• expected outputexpected output

It is not feasible to exhaust every possible caseIt is not feasible to exhaust every possible case

Page 16: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

16

Black-Box TestingBlack-Box Testing

Black-box testingBlack-box testing maps a set of specific inputs to a set of maps a set of specific inputs to a set of expected outputsexpected outputs

An An equivalence categoryequivalence category is a collection of input sets is a collection of input sets

Two input sets belong to the same equivalence category if Two input sets belong to the same equivalence category if there is no reason to believe that if one works, the other will there is no reason to believe that if one works, the other will notnot

Therefore testing one input set essentially tests the entire Therefore testing one input set essentially tests the entire categorycategory

Page 17: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

17

White-Box TestingWhite-Box Testing

White-box testingWhite-box testing is also referred to as glass-box testing is also referred to as glass-box testing

It focuses on the internal logic such as the implementation It focuses on the internal logic such as the implementation of a methodof a method

Statement coverageStatement coverage guarantees that all statements in a guarantees that all statements in a method are executedmethod are executed

Condition coverageCondition coverage guarantes that all paths through a guarantes that all paths through a method are executedmethod are executed

Page 18: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

18

An Evolutionary Development An Evolutionary Development ModelModel We will now divide the process of design intoWe will now divide the process of design into

• architectural designarchitectural design - primary classes and interaction - primary classes and interaction

• detailed designdetailed design - specific classes, methods, and algorithms - specific classes, methods, and algorithms

This allows us to create a This allows us to create a refinement cyclerefinement cycle

Each refinement focuses on one aspect of the systemEach refinement focuses on one aspect of the system

As each refinement is addressed, the system evolvesAs each refinement is addressed, the system evolves

Page 19: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

19

An Evolutionary Development An Evolutionary Development ModelModel

Establish requirements

Architectural design

Establish refinement

scope

Unit and integration test

Implementation

System test

Identify classes & objects

Identify relationships

Detailed design

Page 20: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

20

Refinement CycleRefinement Cycle

First, we establish refinement scope to define the specific First, we establish refinement scope to define the specific nature of the next refinementnature of the next refinement

Such as:Such as:• the user interfacethe user interface

• a particular algorithma particular algorithm

• a particular requirementa particular requirement

Choosing the most appropriate next refinement is Choosing the most appropriate next refinement is important and requires experienceimportant and requires experience

Page 21: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

21

Refinement CycleRefinement Cycle

Next, we identify classes and objectsNext, we identify classes and objects

The ones that relate to the current refinementThe ones that relate to the current refinement

These may overlap with other refinementsThese may overlap with other refinements

Can often define by focusing on the roles they play in the Can often define by focusing on the roles they play in the systemsystem

Consider reusing existing classesConsider reusing existing classes

Page 22: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

22

Refinement CycleRefinement Cycle

Then we identify relationships among classesThen we identify relationships among classes

Inheritance (is-a) relationshipsInheritance (is-a) relationships

The The uses relationshipuses relationship establishes another kind of bond establishes another kind of bond between classesbetween classes• Class A uses class B in some wayClass A uses class B in some way

• Can express cardinalityCan express cardinality

• Example: A Car has (uses) four wheelsExample: A Car has (uses) four wheels

Page 23: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

23

Refinement CycleRefinement Cycle

Finally, detailed design, implementation and testFinally, detailed design, implementation and test

Design of specific methods and their translation into codeDesign of specific methods and their translation into code

A A unit testunit test focuses on one particular component, such as a focuses on one particular component, such as a method or classmethod or class

An An integration testintegration test focuses on the interaction between focuses on the interaction between componentscomponents

Page 24: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

The PaintBox ProjectThe PaintBox Project

We can explore the evolutionary development model using We can explore the evolutionary development model using a larger projecta larger project

The PaintBox program will allow the user to create The PaintBox program will allow the user to create drawings with various shapes and colorsdrawings with various shapes and colors

After establishing the requirements, the following After establishing the requirements, the following refinement steps were established:refinement steps were established:• create the basic user interfacecreate the basic user interface• allow the user to draw shapes and change colorallow the user to draw shapes and change color• allow the user to select, move, and fill shapesallow the user to select, move, and fill shapes• allow the user to edit the dimensions of shapesallow the user to edit the dimensions of shapes• allow the user to save and reload drawingsallow the user to save and reload drawings

Page 25: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

PaintBox Refinement 1PaintBox Refinement 1

The first refinement establishes the basic user interfaceThe first refinement establishes the basic user interface

See See PaintBoxPaintBox.java.java See See PaintFramePaintFrame.java.java See See ButtonPanelButtonPanel.java.java See See DrawingPanelDrawingPanel.java.java

Page 26: Chapter 10: Software Engineering Presentation slides for Java Software Solutions Foundations of Program Design Second Edition by John Lewis and William

PaintBox Refinement 2PaintBox Refinement 2

See See PaintBoxPaintBox.java.java See See PaintFrame.javaPaintFrame.java See See ButtonPanel.javaButtonPanel.java See DrawingPanel.javaSee DrawingPanel.java

See See Shape.javaShape.java See See Line.javaLine.java See See BoundedShape.javaBoundedShape.java See See Rect.javaRect.java See Oval.javaSee Oval.java See Poly.javaSee Poly.java

The second refinement allows the user to draw shapes and The second refinement allows the user to draw shapes and change colorschange colors