CS257 Software Design Wednesday, 21 September 2022 0. Unix things-of-the-day #! -- "shebang" (shell/hash/sharp + bang) chmod +x which ./blah 1. CLI design recap - Observations from the readings - follow design conventions - provide defaults - provide verbose & terse option synonyms - don't force user to remember order of options - support help, version, verbose - let's look at a few teams' submissions (see below) 2. Test-driven development & unit testing - General ideas from TDD reading - write tests while designing code (back and forth process) tests come before implementation - code/implementation should only address the tests excess, untested code shouldn't be there - why? you have tests and some confidence your code does what it's supposed to do - why? you can repeat the tests later "regression testing" - Unit testing coverage issues - Quick walk-through of my sample code - Work on the lab ======= SYNOPSIS python3 books.py author python3 books.py title [-t, -p] python3 books.py A B python3 books.py [-h --help] ======= Synopsis python3 books.py [-h|--help] python3 books.py [-t|--title-search] [search term] [title] python3 books.py [-t|--title-search] [search term] [publication-year] python3 books.py [-a|--author-search] [search term] python3 books.py [-y|--year-search] [yearA] [yearB] ======= NAME searchb - Search for books SYNOPSIS searchb DESCRIPTION searchb takes a search string S and prints a list of books whose titles contain the string NAME searcha - Search for authors SYNOPSIS searcha DESCRIPTION searcha takes a search string S and prints a list of authors whose names contain the string NAME range - Search range of years SYNOPSIS range DESCRIPTION range prints a list of books published between years A and B, inclusive ======= SYNOPSIS search [--help] ...