Stepwise Refinement - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Stepwise Refinement

Description:

Can you think of other designs? We might solve the harvest ... might write the first new command as: void HarvestARow() PickBeeper(); Move ... definition) ... – PowerPoint PPT presentation

Number of Views:400
Avg rating:3.0/5.0
Slides: 11
Provided by: judyhankin
Category:

less

Transcript and Presenter's Notes

Title: Stepwise Refinement


1
Stepwise Refinement
  • A program design strategy where a solution is
    first described in terms of high level functions,
    then each function is broken down into details
    that are refined in successive steps until the
    whole program is fully defined.
  • This PPT originated with Dr. Roland Untch.

2
Harvest Task
3
  • Stepwise Refinement helps us write good
    programs
  • Stepwise Refinement tells us not to delve into
    details too quickly, but to gradually solve the
    problem by breaking it into smaller sub-problems.
  • Each sub-problem is then solved (also using
    stepwise refinement.)
  • Eventually our solutions are expressed in
    detailed terms.

4
Harvest Task Design 1
5
Other Harvest Task Designs
6
Which harvest design is better? Can you think
of other designs?
7
We might solve the harvest problem as
follows include ltkarel.hgt int main()
TurnOn() Move() HarvestARow()
TurnLeft() Move() TurnLeft()
HarvestARow() TurnRight() Move()
TurnRight() HarvestARow() // can you
finish the coding??? // more code goes here..
8
What are the new commands that you used in your
design?? The command HarvestARow() is a new
command, so the next step is to write this
command. We might write the first new command
as void HarvestARow() PickBeeper()
Move() PickBeeper() Move()
PickBeeper() Move()
PickBeeper() Move()
PickBeeper()
9
What other new commands (to Karel) did you use?
We need to write those as well?
10
Stepwise Refinement(another definition)
  • The software design technique that aims to
    describe functionality at a very high level, then
    partition it repeatedly into more detailed levels
    (one level at a time) until the detail is
    sufficiently refined to express directly as code.
  • Also called top-down design.
Write a Comment
User Comments (0)
About PowerShow.com