Saint Louis University |
Computer Science 150
|
Dept. of Math & Computer Science |
Topic: Good Software Practices
Related Reading: Chapter 7
Due:
1:10pm, Friday, 5 April 2013
ELECTRONICALLY
Please make sure you adhere to the policies on academic integrity.
Exercise 7.5 of the text
Please do this problem electronically. You should be able to see the effect of your documentation by doing help(Point) in the interpreter after loading the definitions.
The original undocumented code can be found here (or as turing:/Public/goldwasser/150/book/ch06/RobustPoint.py)
Exercise 7.8 of the text
Please see Practice 7.6 and its solution for a start (albeit brief).
Although unintentional, this is a particularly relevant exercise given that the version of Fraction published in the book is flawed! The provision of __eq__ and __lt__ does not suffice for supporting all of the expected comparison operators: <, <=, > >=, ==, !=. Make sure that your unit tests examine each of those operations, and that they tangibly demonstrate the flaws that exist with the published code. My recommend style for this is to have tests that produce no output when the code is successful, but error messages when a flaw is discovered.
The original untested code, together with embedded gcd function, can be found here (or piecewise within turing:/Public/goldwasser/150/book/ch06/).
Exercise 7.9 of the text