lec15 - Lecture 15 Top-down design Testing Overloading...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
CS125 Course Notes Lecture 15, Slide 1 Lecture 15 •Top-down design •Testing •Overloading (Savitch 5.3)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS125 Course Notes Lecture 15, Slide 2 Top-down design • The practice of dividing large tasks into smaller, more manageable ones. • Also known as stepwise refinement .
Background image of page 2
CS125 Course Notes Lecture 15, Slide 3 Example • Task: Fill entire Board with pegs.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS125 Course Notes Lecture 15, Slide 4 Example continued Fill Board for each row i { fill row i with pegs } Fill Row i for each column j { put peg at position (i,j) }
Background image of page 4
CS125 Course Notes Lecture 15, Slide 5 Coding using top-down design • Each major task identified should be implemented in a method. • The “original” method will call the other helper methods (which may call other helper methods themselves) • Helper methods should be private to their class.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS125 Course Notes Lecture 15, Slide 6 Example continued public void fillBoard() { } private void fillRow(int row) { }
Background image of page 6
CS125 Course Notes Lecture 15, Slide 7 Stub • Simplified version of a method. • Method will not accomplish task, but will allow code to compile and run. • Helpful when using top-down design.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS125 Course Notes Lecture 15, Slide 8 Stubs continued • Example: –When writing fillBoard method, fillRow method was required for code to compile.
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 21

lec15 - Lecture 15 Top-down design Testing Overloading...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online