Robo TDSD - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Robo TDSD

Description:

So make method's pre-conditions explicit. How to tell if met in design? ... All the information needed to make use of the method. HOW. the method works. ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 16
Provided by: davidda3
Category:
Tags: tdsd | make | robo

less

Transcript and Presenter's Notes

Title: Robo TDSD


1
Robo TDSD
...a lightning introduction to top-down
structured design
  • David Davenport
  • Computer Eng. Dept.,
  • Bilkent UniversityAnkara - Turkey.
  • email david_at_bilkent.edu.tr

2
IMPORTANT
  • Students
  • This presentation is designed to be used in class
    as part of a guided discovery sequence. It is not
    self-explanatory! Please use it only for revision
    purposes after having taken the class. Simply
    flicking through the slides will teach you
    nothing. You must be actively thinking, doing and
    questioning to learn!
  • Instructors
  • You are free to use this presentation in your
    classes and to make any modifications to it that
    you wish. All I ask is an email saying where and
    when it is/was used. I would also appreciate any
    suggestions you may have for improving it.

thank you, David.
3
Top-Down Structured Design
  • In essence

How many?
Divide Conquer
What is natural?
Split problem into natural pieces then solve
each piece independently
Each piece is simply another problemIf it is to
big to solve directlyapply divide conquer to
it!
Stepwise refinement
4
The Wishing Well (first attempt)
  • Apply top-down structured design

Split problem into natural pieces solve each
piece independently
140x140x140
150
100x100
Trace it!
5
What went wrong?
  • Design assumption
  • Naïvely assumed that a method always does what it
    is supposed to do!
  • Is it possible to tell Robo to d rect( 50, 100)
    and not have the rectangle appear?
  • A method works properly only if Robo is in the
    initial state assumed by the design

Pre-condition
6
Pre Post Conditions
  • Must ensure pre-conditions satisfied
  • Need to know what they are
  • So make methods pre-conditions explicit
  • How to tell if met in design?
  • Need to know post-conditions too
  • Either trace (error prone!)
  • or make them explicit in method too

7
Pre/Post conditions
  • Pre-condition
  • The required system state prior to execution of
    the method,
  • if it is not actually in this state at run-time,
    the method may fail to perform as specified.
  • Post condition
  • The state of the system after execution of the
    method assuming that its pre-conditions were met.

8
Example
  • The complete rect method

WHAT the method does. All the information needed
to make use of the method
HOW the method works. Only the programmer of this
method need be concerned with this.
9
The Wishing Well (second attempt)
  • Try again

Split problem into natural pieces, and
specify them order to do them in
140x140x140
150
100x100
roof
pole
base
Do these pieces done in this order solve problem?
Its impossible to tell! What other information
is needed?
10
The Wishing Well (third attempt)
  • Try again

Split problem into natural pieces, and
specify them order to do them in
140x140x140
150
100x100
roof
pole
base
Do these pieces done in this order solve problem?
If no fix If yes go ahead and solve them
11
The Wishing Well (third attempt)
  • Possible solutions

12
Wishing Well
  • First Top-Down Design

13
Wishing Well
  • Then Implement

Comments omitted from presentation for
clarity! Also, need ways to tie design code
together better
14
The Wishing Well (fourth attempt)
  • Try yet again this time utilising existing
    methods where possible

140x140x140
150
100x100
3
2
1
roof
pole
base
Do these pieces done in this order solve problem?
No fix by introducing new pieces changing
program
15
Your turn!
  • In class?
  • House
  • Homework... (for lab)
  • Rocket
Write a Comment
User Comments (0)
About PowerShow.com