Course Information

Beautiful Code
Ka-Ping Yee, February 26, 2003

This is a DeCal course offered in the Spring 2003 semester. It's the first course I've designed on my own, though I have some previous experience as a teaching assistant. Nonetheless, be prepared for a little experimentation and perhaps unconventional methods...

Short Description

This course will introduce you to the Python programming language from a design point of view, with an emphasis on practical ways to use Python to make your computer more useful to you. You'll learn about string processing, object-oriented programming, e-mail handling, and Web site scripting, while getting experience with good programming practices like code review, testing, debugging, and refactoring.

What is Python?

Python is an interpreted, object-oriented programming language that runs on just about any popular operating system. It has very clear syntax, provides useful high-level built-in types, and comes with a large and capable standard library. It is often compared to other languages such as Perl, Tcl, Scheme, or Java.

Target Audience

That would be you, I hope. You should have done some kind of programming before taking this course. We won't spend time explaining what it means to program a computer, though we'll quickly go over basic programming ideas as part of introducing how things are done in Python.

If you've taken a programming course before, the course probably taught Scheme (if you're lucky), or Java, or C, or C++ (if you're not so lucky). But do you ever write programs to save yourself time and effort, to get your computer to help you get things done? If you already write programs for yourself (or, say, a website), you might find that Python works better for some purposes. If you don't program for yourself, maybe that's because it's too much trouble to write programs, or to set up the language tools on your computer. Python will be a refreshing change: it's one of the easiest languages to use, to read, and to learn, and yet it gives you a lot of power. I hope this course will give you a new level of control over your computer and open up a range of possibilities for you to use it in new and productive ways.

If you've never written a program before, this course might not be for you. However, if you're technically inclined, keen, and willing to do some exploration on your own, talk to me about taking the course. (I personally think Python is the best choice of a first language for most people who want to learn how to program.)

Why would you want to learn Python?

Coordinator

That would be me, Ping (ping@zesty.ca). I've been using Python for a while now, and gotten to be friends with some of the nice Python folks. I'm here to help you. Please feel free to write to me with any questions you have about the course.

Enrollment

There are two sections, one for lower division and one for upper division, but they're the same course. In order to enroll, you must fill out the online survey and you must attend the first class. This is a 2-unit course, pass/no-pass.

Prerequisites

You should have done some sort of programming before. If you haven't, but you're really keen, have a technical mind, and an appetite for tinkering, talk to me about taking the course. If you aren't already comfortable with using a text editor (any editor is fine) or installing software on your computer, then this course probably isn't for you.

You will need to have a computer, or access to a computer account on campus (the OCF provides free computer accounts for Berkeley students). We won't require any special tools beyond Python and a text editor. You can download Python for your platform (Linux, MacOS, or Windows) at http://python.org/. If you are using Linux, Python is likely already installed; you can check by typing in the command "python".

Course Goals

Python is good for writing programs for yourself, and for other people. So these will be the two main goals. By the end of the course:

Meetings

We'll meet weekly on Wednesdays from 4pm to 6pm in 320 Soda Hall. The first class will be on January 22. I really want to encourage you to get used to looking at code, so we'll spend the first part of each class reviewing and discussing everyone's work, and then the second part of the class teaching new material. I realize it may sound a little scary to have everyone looking at your work. Don't let that frighten you: I want you to get used to the idea (because that's what happens in real life), and come to be proud of what you write.

Assignments

There will be an assignment each week. Each assignment will be due at 6 pm on the Monday after it is assigned so that there is time to have them graded before the next class. You'll submit the assignments by e-mail. All of the work you do will be posted on this web site for other students to look at. The idea is that you'll have all weekend to do the assignment, I'll get them and post them on Monday, I'll grade them on Tuesday, and you'll have a day if you want to look at everyone's work before class on Wednesday.

There will also be a final project, which should result in a program that you can go on using after this course is over. I'll suggest some topics for final projects, but they're only ideas; I will be looking for project proposals from you by the eighth week of class (March 12).

Grading

Every assignment will get two grades: one for correctness, and one for readability. Not all the assignments will ask you to write a program; some will ask you to modify existing programs.

A plus and minus cancel, leaving you with two checks. A missing assignment gets an X. Four pluses cancel an X. Assignments can be submitted late to turn any X into a check-minus. At the end of the semester, you must have no X's and fewer than six minuses in order to get a passing grade.

(This grading scheme is based on the one used by the Perl people. I owe my thanks to them.)

Resources

As we cover the Python language itself, we'll follow a textbook called "How to Think Like a Computer Scientist". Fortunately, the entire book is freely available online. You can also buy this book if you want a printed copy.

After we've covered the language, we'll talk about the standard library to get you familiar with the tools it provides for you. We won't be using a book for this part.

Here are some links to other information and books that you might want to look at: