Design-by-Contract
7 January 2019 OSU CSE 1
Design-by-Contract 7 January 2019 OSU CSE 1 Systems Thinking A - - PowerPoint PPT Presentation
Design-by-Contract 7 January 2019 OSU CSE 1 Systems Thinking A system is any part of anything that you want to think about as an indivisible unit An interface is a description of the boundary between a system and everything
7 January 2019 OSU CSE 1
7 January 2019 OSU CSE 2
7 January 2019 OSU CSE 3
7 January 2019 OSU CSE 4
7 January 2019 OSU CSE 5
7 January 2019 OSU CSE 6
7 January 2019 OSU CSE 7
7 January 2019 OSU CSE 8
7 January 2019 OSU CSE 9
7 January 2019 OSU CSE 10
7 January 2019 OSU CSE 11
7 January 2019 OSU CSE 12
7 January 2019 OSU CSE 13
double a, b; … double c = sqrt (a*a + b*b, 0.001);
7 January 2019 OSU CSE 14
double a, b; … double c = sqrt (a*a + b*b, 0.001);
7 January 2019 OSU CSE 15
/** * ... * @param x number to take the square root of * @param epsilon allowed relative error * @return the approximate square root of x * @requires * x > 0 and epsilon > 0 * @ensures <pre> * sqrt >= 0 and * [sqrt is within relative error epsilon * of the actual square root of x] * </pre> */ private static double sqrt(double x, double epsilon)
7 January 2019 OSU CSE 16
/** * ... * @param x number to take the square root of * @param epsilon allowed relative error * @return the approximate square root of x * @requires * x > 0 and epsilon > 0 * @ensures <pre> * sqrt >= 0 and * [sqrt is within relative error epsilon * of the actual square root of x] * </pre> */ private static double sqrt(double x, double epsilon)
7 January 2019 OSU CSE 17
7 January 2019 OSU CSE 18
7 January 2019 OSU CSE 19
7 January 2019 OSU CSE 20
/** * ... * @param x number to take the square root of * @param epsilon allowed relative error * @return the approximate square root of x * @requires * x > 0 and epsilon > 0 * @ensures <pre> * sqrt >= 0 and * [sqrt is within relative error epsilon * of the actual square root of x] * </pre> */ private static double sqrt(double x, double epsilon)
7 January 2019 OSU CSE 21
/** * ... * @param x number to take the square root of * @param epsilon allowed relative error * @return the approximate square root of x * @requires * x > 0 and epsilon > 0 * @ensures <pre> * sqrt >= 0 and * [sqrt is within relative error epsilon * of the actual square root of x] * </pre> */ private static double sqrt(double x, double epsilon)
7 January 2019 OSU CSE 22
/** * ... * @param x number to take the square root of * @param epsilon allowed relative error * @return the approximate square root of x * @requires * x > 0 and epsilon > 0 * @ensures <pre> * sqrt >= 0 and * [sqrt is within relative error epsilon * of the actual square root of x] * </pre> */ private static double sqrt(double x, double epsilon)
7 January 2019 OSU CSE 23
/** * ... * @param x number to take the square root of * @param epsilon allowed relative error * @return the approximate square root of x * @requires * x > 0 and epsilon > 0 * @ensures <pre> * sqrt >= 0 and * [sqrt is within relative error epsilon * of the actual square root of x] * </pre> */ private static double sqrt(double x, double epsilon)
7 January 2019 OSU CSE 24
/** * ... * @param x number to take the square root of * @param epsilon allowed relative error * @return the approximate square root of x * @requires * x > 0 and epsilon > 0 * @ensures <pre> * sqrt >= 0 and * [sqrt is within relative error epsilon * of the actual square root of x] * </pre> */ private static double sqrt(double x, double epsilon)
7 January 2019 OSU CSE 25
7 January 2019 OSU CSE 26
7 January 2019 OSU CSE 27
7 January 2019 OSU CSE 28
7 January 2019 OSU CSE 29
7 January 2019 OSU CSE 30
7 January 2019 OSU CSE 31
7 January 2019 OSU CSE 32
7 January 2019 OSU CSE 33
7 January 2019 OSU CSE 34
7 January 2019 OSU CSE 35
7 January 2019 OSU CSE 36
7 January 2019 OSU CSE 37
7 January 2019 OSU CSE 38
7 January 2019 OSU CSE 39
7 January 2019 OSU CSE 40
7 January 2019 OSU CSE 41
7 January 2019 OSU CSE 42
7 January 2019 OSU CSE 43
7 January 2019 OSU CSE 44
7 January 2019 OSU CSE 45