CS257 Software Design Monday, 26 September 2022 1. Questions on books assignment(s) - unit testing - command-line arguments - the BooksDataSource class - other implementation questions - ??? 2. Debugging python in VS Code 3. Reading: High-Quality Routines - Naming: understandable/descriptive name - don't differentiate variables by number (s1, s2,...) - use full words in names - some conventions: boolean-valued functions can be "is_letter" or "has_moose" - some conventions: getters and setters get_radius, set_radius (but languages also have "properties") - Routines help reduce complexity; reduce duplicate code - A routine should do one thing ("functional cohesion") - routines shouldn't talk to the user unless that's their whole purpose def factorial(int n): if n < 0: print(f'Bad n: {n}') # NOOOO; raise an exception or return some default value ... return ... 4. Reading: The Commento - Too many comments obscure the code - Well-named variables, routines eliminate the need for many comments - Good comments - over-arching idea expression - top of a non-trivial routine - top of file - long functions - brief signposts as headers of sub-sections - citations - explanation of complicated/obscure algorithm 5. Coming up - Wednesday: start talking about database-driven web applications - Friday: lab about the postgresql database management system - Monday: code reviews for books assignment 6. Work time