CptS 481: Python Software Construction

WSU Tri-Cities and WSU Pullman
Fall, 2020

Document Update History

Date Update
12/9 added details to SuperQuiz day and time
12/3 added "Advanced Python" unit (and notes)
12/1 added SuperQuiz (i.e., final exam) day and time
12/1 added link to project demonstration sign-up spreadsheet
11/20 updated New Mexico Tech Tkinter reference to version 8.5
11/12 added links of "Life" game to schedule
11/5 revamped project requirements
10/14 date correction
10/8 adjusted schedule
9/23 adjusted schedule
8/31 minor correction; added revised Part 1, Chapter 4 of text
8/27 made Personal Zoom a hyperlink
8/18 initial publication

Instructor

Bob Lewis
Associate Professor, WSU TC
Office: Floyd 134D
Campus Phone: 2-7178
Off-Campus Phone: (509) 372-7178
Call Phone: (509) 374-7520
Personal Zoom: https://wsu.zoom.us/j/5635500668
Email: bobl@wsu.edu (be sure to include "cpts481" in the subject line of all course-related correspondence)
Web Page: http://www.tricity.wsu.edu/~bobl
Office Hours: W 3-5pm

System Administration

Tri-Cities

tchelp@tricity.wsu.edu
Campus Phone: 2-7334
Off-Campus Phone: (509) 372-7334

Pullman

support@eecs.wsu.edu
Campus Phone: 5-6773
Off-Campus Phone: (509) 375-6773

Lecture

TuTh 12:05-1:20pm
Tri-Cities: Zoom (via Blackboard)
Pullman: Zoom (via Blackboard)

Catalog Description

481 Python Software Construction 3 Course Prerequisite: CPT S 223 with a C or better; CPT S 224 with a C or better; admitted to the major or minor in Computer Science, Computer Engineering, Electrical Engineering, Software Engineering, or Data Analytics. Intensive introduction to the python language; user interface, building and using extension modules; C interfacing; construction of a major project.

Goals

This is an advanced course in the Python programming language. There will be a focus on understanding Python internals in a way that connects them to your knowledge of other languages, especially C and C++. Even if you've programmed in Python before, you will gain insights that will make you a better Python programmer and a better programmer in general.

You will also learn how to use Python to integrate preexisting modules (and C code) together to construct substantial applications that have a much larger scope of capabilities than you have used before. One of those modules will be Tkinter, which you will use to build user interfaces.

An overall theme will be the use of Python as a "force multiplier" to produce more reliable, more maintainable, more readable, better-documented, more througly-tested and overall higher-quality code.

The class will make use of the latest version of Python, version 3 (3.8, to be precise), otherwise known as "Python 3000" or "Py3K".

Prerequisites

The official prerequisites (see ebove) are CptS 223 with a C or better and CptS 224 with a C or better, admitted to the major or minor Computer Science, Computer Engineering, Electrical Engineering, Software Engineering or Data Science majors.

More specifically, the course requires experience in an object-oriented programming language like C++ or Java, and some proficiency in computer use via the command line is expected. This should include, at a minimum, the ability to log on, send email, edit text files, and run programs.

As its course number suggests, even though Python is an excellent first programming language, the pace at which the material is presented makes this course inappropriate as a first programming course.

Resources

Text

The text for the class is The Book of Python. This is a work-in-progress by the instructor and his collaborators that will be provided in draft PDF form to you at no charge. The work is copyrighted and is not to be disseminated outside of class.

The Book of Python has not been completely verified to work with Python 3.8, but the changes are mostly upward compatible. New features will be covered in lecture.

In addition, the first student to report (via email) a previously-unknown discrepancy between the text and the Python 3.8 interpreter will earn a class participation tally and a mention in the acknowledgements.

To access the text, log in to http://www.tricity.wsu.edu/~bobl/cpts481/book_of_python. You will be asked for a login and password, which will be given out in class (or call the instructor). You will then be able to access a directory containing PDF files of the individual chapters. You may download, view, and print these files for your own use, but (as stated above) please do not disseminate them outside of class. Hyperlinks to the individual chapters will appear in the schedule as readings are assigned.

Student comments on the text, especially in the form of written errata, are extremely welcome.

Instructor Contact

Due to COVID-19, the instructor is offering an increased amount of contact. During office hours, he will be available at his personal Zoom address. At other (reasonable) times, you may reach him at his cell phone number to ask questions or set up an individual Zoom meeting. You may also reach him by email. If you have difficulty reaching him by other means, you're welcome to call.

Too many students assume that they're on their own to do the homework. This can lead to panic and possibly seeking help in a way that could lead to a violation of academic integrity. When you've made a good effort on the homework, reading, or project and feel "stumped", the instructor welcomes contact.

Additional Readings

Additional readings will be in these two references on Tkinter, freely downloadable:

References

Lutz, Mark. Learning Python, O'Reilly.

Summerfield, Mark. Programming in Python 3, Addison Wesley.

Beazley, David M. Python Essential Reference, Addison Wesley.

Web Page

http://www.tricity.wsu.edu/~bobl/cpts481

General Python Information

There is an enormous repository of Python information including documentation, source code, news, tutorials, and examples at http://www.python.org.

Accessing Python

To complete assignments in this class, you will, at a minimum, need access to a Python interpreter and some basic shell tools. Remember that however you access Python, you must still adhere to the rules given in the Homework section below.

Use Python From a Linux Distribution

Most Linux distributions (e.g. Ubuntu) have all you need to develop Python code. This is what the instructor prefers for Python code development, with the traditional UNIX combination of a text editor (emacs) and the occasional shell (bash) window, mainly to run the Python executable.

For those of you with Windows 10 systems, this may also work if you have WSL (Windows Subsystem for Linux) installed, but this is unconfirmed.

Use Python on a WSU System

In past years, students had access to Python via "live" computer labs on both campuses. With COVID-19 present, lab access has become restricted, if not impossible.

Tri-Cities students, however, can access Python via ssh to the elec.tricity.wsu.edu compute server. If you use a Windows program with a X server like MobaXterm, you may even be able to run programs that use a graphical user interface (GUI), including the Tkinter package we'll be using in this course. (The latter is unconfirmed.)

It is not yet known if Pullman students have a similar option.

Install Python from python.org

You can download and install Python (e.g. for Windows) from www.python.org/download . Many platforms are supported.

Install a Python IDE

You may develop your Python code with an integrated development environment. There are quite a few, and a good summary of them is at http://wiki.python.org/moin/IntegratedDevelopmentEnvironments . PyCharm in particular is well spoken-of.

Accessing Jupyter Notebook

The class will be taught primarily using Jupyter Notebook, a browser-based interactive interface to an underlying Python engine. Although not required for the class, Jupyter Notebook is very useful for instruction and individual "exploration" either of the language itself or of data. Jupyter Notebook sessions from class will be available after lectures via the schedule (see below), both in notebook (".ipynb") and HTML formats.

You are welcome to install Jupyter on your own system. It's available for all common platforms. See http://www.jupyter.org . Jupyter includes Jupyter Notebook by default. Be sure to get the Py3K version.

You might also consider installing the Anaconda distribution from Continuum Analytics, downloadable from https://www.anaconda.com/products/individual (at no charge). This package, which was designed for use in data science, includes not only Python, but Jupyter Notebook and many useful Python packages.

Pullman EECS IT has Anaconda installed on the Linux workstations in EME 205, but you can't use it there for now.

Outline

These are the units we will cover in the course together with the approximate number of weeks we will spend on them.

Schedule

Readings are in The Book of Python unless otherwise indicated. ``--'' means a continuation of the previous topic. ``Ch. p-c'' refers to Chapter c in Part p. ``Sec. p-c.s'' refers to Section s of Chapter c in Part p. ``HWn'' refers to Homework #n.

Week Tuesday Topic Thursday Topic
1 8/25 1. Overview
Ch. I-1 (read after class)
8/27 2. Program Structure and Identifiers
Chs. I-2 and I-3
Quiz #1
2 9/1 3. Base Classes
Ch. I-4
Quiz #2
9/3 --
Ch. I-5
Quiz #3
3 9/8 4. Expressions 9/10 5. Statements
Ch. I-6
Quiz #4
4 9/15 6. Functions
Ch. I-7
Quiz #5
9/17 --
HW1 assigned (due 9/29)
5 9/22 7. Modules and Packages
Ch. I-8
9/24 8. Input/Output
Ch. I-9
Quiz #6
6 9/29 9. Objects
Secs. I-10.1 through I-10.7
HW2 assigned (due 10/6)
10/1 --
Secs. I-10.8 through I-10.11
Quiz #7
7 10/6 --
HW3 assigned (due 10/20)
10/8 10. Exceptions
Ch. I-11
Quiz #8
8 10/13 11. Builtins
Ch. I-12
10/15 12. Documenting
Ch. II-1
9 10/20 13. Checking and Debugging
HW4 assigned (due 10/29)
10/22 14. Testing
Chs. II-2 through II-4
10 10/27 15. Tkinter
Lundh
New Mexico Tech
Start thinking seriously about your project (see below).
10/29 --
HW5 assigned (due 11/12)
11 11/3 -- 11/5 16. Distributing
Welcome to Setuptools' documentation!
12 11/10 -- 11/12 17. System Programming
Chs. III-1 through III-8
HW6 assigned (due 11/19)
A Life-based Universal Turing Machine
Nicholas Loizeau's Life-based Computer
13 11/17 18. Embedding and Extending
Chs. II-5 and II-6
11/19 --
HW7 assigned (due 12/3)
14 11/23-11/27: Thanksgiving Week, no classes
15 12/1 19. Arrays
NumPy User Guide
12/3 20. Advanced Python
16 12/8 Project Demonstrations for Tri-Cities students
sign up here.
(see below for more information)
12/10 Project Demonstrations for Pullman students
sign up here.
(see below for more information)
17 Thursday, 12/17, 10:30am-12:30pm: "SuperQuiz" -- see below -- given instead of final (Enter via Blackboard using passcode sent by email.)
Friday, 12/18, 5pm: Project submissions due. NO LATE SUBMISSIONS!

This schedule may be revised as the course progresses.

Grading

The grade will break down as follows:

25% Quizzes
45% Homework
25% Project
5% Class Participation

Quizzes

During the first half of the course, there will be several in-class quizzes to test the extent of your Python knowledge. You will be allowed 15 minutes to complete each quiz. (this time may change -- notification will be provided) to complete it. The quizzes will be conducted using the Blackboard Course Management System. It is your responsibility to be sure you can access your Blackboard account during class. The quizzes will be based on the reading assignments and may cover topics not brought up in lecture. You are expected to come to class having done the reading.

Although there is no Final for the class as such, the time allotted for it in the schedule will be devoted to a "SuperQuiz" where you will be allowed to take (or re-take) possibly-modified versions of the quizzes. Participation is optional, but an improved score on the SuperQuiz will replace the corresponding prevous quiz score. The possible SuperQuiz modifications may change the answers and/or the order of the questions, but not their topic or level of difficulty. (Memorization will not be the best strategy here!)

Except in the case of a documented, excused absence (e.g., a medical or work-related reason), quizzes cannot be made up except at the SuperQuiz.

Quizzes are intended to be part of your learning experience. Some of the quiz questions are easy and some of them are hard. Do not despair if you don't get every question right, especially at first. Study the correct answer (which will be provided) so that you get it right on the SuperQuiz.

Homework

There will be several homework assignments requiring coding in Python.

As the language is available for a wide range of platforms (see above), you may work on your assignments on the platform of your choice.

However, the grader will test all programming assignments under the Linux operating system, and you are responsible for making sure that your code works using a Python 3.8 interpreter on that platform. Earlier versions than 3.8 might work, but any extra steps the grader needs to make programs runnable (at his discretion) will cause points to be deducted.

To submit an assignment:

  1. Place all files in a gzip-compressed tarball. The name of the tarball should include "cpts481", the abbreviated name of the assignment, and your login. For example, the user "jcleese" submitting Homework 3 would submit a tarball named "cpts481_hw03_jcleese.tgz".
  2. Submit the tarball via Blackboard to the instructor.

The timestamp on the Blackboard submission will be considered the time of submission.

To test your program, the grader will

  1. un-tar the tarball in an otherwise empty directory, and
  2. run the program with Python.

Anything that requires more effort on the grader's part than this will cause points to be taken off. Special notes to the grader may be included in an optional README.txt file included in the tarball, not any other part of the Blackboard submission.

Homework is due at the start of class on the given due date. Unless otherwise noted, late submissions are accepted up until exactly one week after the due date, with a 10% penalty.

Grades and remarks will be returned through Blackboard.

Project

During the last third of the class, you will build a Python-based system of your own design. Ideas for projects may be discussed with the instructor at any time, but you should start thinking seriously about a project when we cover the Tkinter module in Week 10.

A major criterion for every project is that it be ambitious. As an approximate rule, it should require as much effort as three homeworks.

The project must make use of the Python documentation (Unit 12), testing (Unit 14), and distribution (Unit 16) facilities we describe in class. The final submission will be in the form of a setuptools "sdist" (source distribution) package. Be sure to extract your package and confirm that "$ python3 setup.py build" and "$ python3 setup.py install --user" work under Linux. Projects which include a database must include a non-trivial database for the grader to use for evaluation.

At some point during the last week of class, you must also describe (perhaps with a brief slide show) and demonstrate your working project to the class. You will have 10 minutes for your demonstration. Sign up on this Google Docs spreadsheet .

While it is strongly recommended that you have a submit a project proposal for approval by the instructor, it is not required.

If You are Submitting a Proposal

The way to start this is to fill in a Project Proposal Form (a Google Forms document). Take time to review this form before you fill it out. You may even want to try out some modules before you submit it. You can make any changes you like before submitting it, but make no changes after that without instructor approval.

Getting a proposal approved may require one or more iterations, but once approved, you will know that you will receive full credit if you build what you propose. Approval will consist of an email from the instructor with the words "You are approved."

Although you are encouraged to propose projects of your own design, a page of project ideas is maintained here. Only one implementation of each of these is allowed and the first student to claim one in a proposal will have "dibs".

If You are not Submitting a Proposal

If you do not submit a proposal, you are relying on the judgement of of the instructor about the quality and ambitiousness of your project. In addtion, you must submit a proposal if (a) your project is being shared with another class or (b) you a using one of the project ideas referred to above.

Class Participation

Although you grade is not based on attendance, there will be a small fraction based on class participation. During lecture, the instructor will direct questions at specific students, who will be chosen in a round-robin fashion.

If the student attempts to answer the question, right or wrong, and responds to any "hints" from the instructor, they will receive a tally mark for participation. If they don't answer or say "pass" or "I don't know" or the like, they will receive no mark.

The class participation component of the grade will be based on the relative number of tally marks recorded over the semester.

Percentage-to-Letter Grade Mapping

The numerical grade is mapped to a final letter grade based on the instructor's subjective evaluation of the overall difficulty of the course, with the following constraints:

A numerical grade
in this range...
... guarantees a letter grade
which is at least...
90 ≤ grade ≤ 100 A-
80 ≤ grade < 90 B-
70 ≤ grade < 80 C

As the course progresses, the instructor is free to revise these criteria downwards so that, for example, 87% might still result in some kind of A (an A-, say), but the limits of these ranges will not be raised.

Academic Integrity

Academic integrity is the cornerstone of higher education. As such, all members of the university community share responsibility for maintaining and promoting the principles of integrity in all activities, including academic integrity and honest scholarship. Academic integrity will be strongly enforced in this course. Students who violate WSU’s Academic Integrity Policy (identified in Washington Administrative Code (WAC) 504-26-010(4)

In the case of a violation on a quiz or superquiz, both the quiz and the matching superquiz will receive a zero.

Cheating includes, but is not limited to, plagiarism and unauthorized collaboration as defined in the Standards of Conduct for Students, WAC 504-26-010(3). You need to read and understand all of the definitions of cheating.

If you have any questions about what is and is not allowed in this course, you should ask course instructors before proceeding.

If you wish to appeal a faculty member's decision relating to academic integrity, please use the form available at communitystandards.wsu.edu . Make sure you submit your appeal within 21 calendar days of the faculty member's decision.

Accommodations

Students with Disabilities

Reasonable accommodations are available for students with documented disabilities or chronic medical or psychological conditions. If you have a disability and need accommodations to fully participate in this class, please visit your campus’ Access Center/Services website to follow published procedures to request accommodations. Students may also contact their campus offices to schedule an appointment with a Disability Specialist. All disability related accommodations are to be approved through the Access Center/Services on your campus. It is a university expectation that students visit with instructors (via email, Zoom, or in person) to discuss logistics within two weeks after they have officially requested their accommodations.

For more information contact a Disability Specialist on your home campus:

Religious Observances

Washington State University reasonably accommodates absences allowing for students to take holidays for reasons of faith or conscience or organized activities conducted under the auspices of a religious denomination, church, or religious organization. Reasonable accommodation requires the student to coordinate with the instructor on scheduling examinations or other activities necessary for course completion. Students requesting accommodation must provide written notification within the first two weeks of the beginning of the course and include specific dates for absences. Approved accommodations for absences will not adversely impact student grades. Absence from classes or examinations for religious reasons does not relieve students from responsibility for any part of the course work required during the period of absence. Students who feel they have been treated unfairly in terms of this accommodation may refer to Academic Regulation 104 - Academic Complaint Procedures .

Safety

Classroom and campus safety are of paramount importance at WSU, and are the shared responsibility of the entire campus population. WSU urges students to follow the “Alert, Assess, Act” protocol for all types of emergencies and the “Run, Hide, Fight” response for an active shooter incident. Remain ALERT (through direct observation or emergency notification), ASSESS your specific situation, and ACT in the most appropriate way to assure your own safety (and the safety of others if you are able).

Please sign up for emergency alerts on your account at MyWSU to receive notification regarding campus emergencies (including campus closures). Click "Update Now!" Under “Tri-Cities Emergency Info” to register for notification by text message, e-mail, telephone, or any combination of the three. Providing multiple contact methods will help ensure you receive notifications in a timely manner, and your information will NOT be used for any other purpose. The following video to learn about WSU Tri-Cities’ safety and emergency protocols: https://www.youtube.com/watch?v=WClaZzSvao4&feature=youtu.be . For more information on this subject, campus safety, and related topics, please view the WSU safety portal .

COVID-19 Statement

Students are expected to abide by all current COVID-19 related university policies and public health directives, which could include wearing a cloth face covering, physically distancing, self-attestations, and sanitizing common use spaces. All current COVID-19 related university policies and public health directives are located at https://wsu.edu/covid-19/ . Students who do not comply with these directives may be required to leave the classroom; in egregious or repetitive cases, students may be referred to the Center for Community Standards for university disciplinary action.

Severe Weather Policy

For severe weather alerts, see: http://alert.wsu.edu/ and https://oem.wsu.edu/emergency-procedures/severe-weather/ . In the event of severe weather affecting university operations, guidance will be issued through the alert system.

Emergency Evacuations (Tri-Cities)

If the alarm sounds, everyone must leave the building. Try to stay together. Your instructor will be the last one to exit the room, close the door(s), and direct you to the assembly areas. If any student is unable to evacuate, please notify immediately the evacuation coordinator (who will be wearing a green vest.

The assembly areas are:

Student Support Services (Tri-Cities)

Academic success can be challenging if you have trouble meeting basic needs like safe shelter, sleep, and nutrition. If you have difficulty affording groceries or accessing sufficient food to eat every day, lack a safe and stable place to live, have an emergency, or just need support, I urge you to contact Student Support Services at 509-372-7433, review the list of services available on the Student Support Services website, stop by the Cougar Cupboard in the East Commons, and/or speak to a member of the team. We want to help you. If you have a friend who needs support, consider filling out a Cougar Cares or review the list of services available on the Student Support Services website .

CH2M STEM Tutoring Center

Free tutoring in math, biology, chemistry and physics, on a drop-in basis is available for undergraduate students. Tutoring will be delivered virtually. To find subject and tutor hours, please visit the CH2M Tutor website .

The Writing Center

The Writing Center (located on the second floor of the Max E. Benitz library) offers free writing support to all Washington State University students. Our Writing Center consultants—undergraduate and graduate students at WSUTC themselves—can help you with various writing issues you may encounter, from generating ideas to revision. I urge you to meet with different consultants and find one with whom you work well, as students have found that the one-on-one attention available in the Writing Center can be very helpful for their writing process. Although you may walk in for assistance at any time, scheduling an appointment is encouraged. When you schedule an appointment, you may select the specific day and time of your consultation, and you are guaranteed at least 30 minutes of one-on-one time with the peer writing consultant of your choice. Schedule an appointment at: https://tricity.mywconline.com/

Students in Crisis

If you or someone you know is in immediate danger, DIAL 911 FIRST!
Other contacts: