Syllabus

Beautiful Code
Ka-Ping Yee

This is the lesson plan for the course. There are four parts to each week:

Ha! Like anything is going to be that exact... :)

You get to propose your own projects. They'll be done in pairs. Here are some guidelines:

The kind of thing I have in mind for a project would be a simple CGI application, Tkinter application, Web scraper, or e-mail generator. I'm going to expect the projects to be submitted with some design documentation, an explanation of whether the tests were passed, and a discussion of whether the tests were modified and why. After I get the projects, I'll assign each team to review someone else's project. The last two class meetings will consist of discussions led by the reviewers, in which they examine the readability and correctness of projects, and possibly make suggestions for design improvements.

week   discuss   present   explore   craft
1. Jan 22 Introductions: talk about yourself. Self-sorting games. Pseudonyms. Enrollment. Homework. Projects. Partnerships. Course philosophy. What is Python? Installing Python. Using the interactive interpreter. Script files. Online help. Numbers and strings. Function calls. str() and repr(). Types. None. Type conversion and coercion. Operators. Variables. Statements and expressions. Conditionals and loops. Simple scripting exercise. (Individual.)
2. Jan 29 Follow-up: None, pass, print. The critique process. First critique. Defining functions. The call stack. Tracebacks. Functions and docstrings. global. The pitfall of "print x; x = 1". make_adder. / Comparisons. Formatting with %. / Importing and defining modules. reload(). Namespaces. / String indexing and slicing. List indexing and slicing. Refactor a program. Design a module. (Individual.)
3. Feb 5 Review and critique. What makes a good name? What's a method? What's a regular expression? Optional and keyword arguments. / Iteration over strings, lists, and files. range() and zip(). / List methods. String methods. Dictionaries. / The re module. Text processing. Implementing a spec. (Partnered.)
4. Feb 12 Review and critique. Specifying interfaces. The class project. Tuples. Mutability and immutability. Aliasing. Object equality and identity. Packing and unpacking. Variadic functions. max() and min(). / map(), filter(), and reduce(). List comprehensions. / Slice assignment. [:]. Integration and debugging. (Individual.)
5. Feb 19 Review and critique. HTML forms. CGI. CGI programming. The cgi module. / Serialization and persistence. The pickle module. CGI scripting. (Partnered.)
6. Feb 26 Review and critique. Project possibilities. Classes, objects, and attributes. Raising and catching exceptions. Bound and unbound methods. Defining classes. Special methods. Sequence, mapping, and number protocols. Designing and testing an interface. (Partnered.)
7. Mar 5 Project partners. Testing. assert. Inheritance. The os module. The urllib module. The smtplib module. / Class attributes. Inheritance. Defining custom exceptions. Black-box testing. (Partnered.)
Project partner selection and proposals due on March 10.
8. Mar 12 Review and critique. XML. XML processing. The DOM. Introduction to Tkinter. No assignment.
9. Mar 19 Review and critique. Tkinter demo. Callbacks. Building user interfaces with the Tkinter module. Interface design. (Individual.)
Project proposals finalized on March 21.
10. Mar 26 Spring break. Woohoo! (Python Conference in DC, March 26–28.)
11. Apr 2 Review and critique. What makes a good interface? Interface review and design exercise. Iterators and generators. No assignment. (Project work.)
Tests due on April 7.
12. Apr 9 I'm away at CHI 2003. Defining and using packages. __getattr__, __setattr__, and __dict__. No assignment. (Project work.)
13. Apr 16 Review and critique. Fringe Python (e.g. new-style classes, true division). Project work time. No assignment. (Project work.)
Projects due on April 21.
14. Apr 23 Project discussion. Project presentation party. Critique and propose design improvements for someone else's project. (Partnered.)
15. Apr 30 Project reviews.
16. May 7 Project reviews.