Princeton University
Computer Science Dept.

Computer Science 333:
Advanced Programming Techniques

Spring 2014

Brian Kernighan

Mon May 12 15:05:47 EDT 2014


For people doing phone apps: meet (some subset of) us in the Tea Room on Wednesday or Thursday 1-4 (and possibly Friday 10-12, but that's really just for backup). No need to make an appointment; just show up. Only one group member and device needs to show up, though more might make things go faster.

Thanks to everyone for four days of great demos. By the way, our non-student visitors included present and former community auditors and others from a variety of places both on and off campus. Most of them have technical backgrounds in computing, and often have had significant managerial roles as well. When they tell me, as they did repeatedly, that you are doing remarkable work, it means something.

Also we all owe a big debt to Janet Temos, MR Daniels and Sorat Tungkasiri from OIT for their invaluable help with the A/V systems. I asked to borrow some iPhone connectors and got four days of first-rate on-site support.

Now the final bit: here are instructions for final submission by 5 PM on Tuesday, May 13. These echo what was said earlier, but with some minor revisions, so please read carefully. And watch this space for further info about how we will test phone apps.


Lecture notes:    2/4    2/6    2/11-13    2/18    2/20    2/25    2/27    3/4    3/6    3/11-13    3/25    3/27    4/1 (Adam Ernst)    4/3    4/8 (Joel Reidenberg)    4/10    4/15 (Bjarne Stroustrup)    4/17    4/22    4/24    4/29    5/1   

Assignments:    1         2         3         4         5        

Project:    preliminary description     previous projects     comments from previous projects     design document template (2/19)     project ideas from around the university (2/26)     web frameworks article     CAS code as tar file     What to do the week after break (3/24)     Project groups and TA assignments     Intro to Web Dev (Collin)     Intro to hacking (Shu)     iOS tutorials     iOS tutorial from Apple     Project groups (4/15)     Project demo information (4/12)     Advice for demos (4/30)    

Readings:    general bibliography     language tutorials    

Old stuff:    Piazza     playlist     survey     Alan Perlis Epigrams in Programming     Web data feeds from OIT     How SQLite3 is tested     SQL injection attacks     RE mysteries in Gawk     The Mother of All Demos     Google style guides:     C++     Python     Javascript     Java     You and Your Research     Doug McIlroy's Virology 101     50th anniversary of BASIC

Dates: All dates are subject to minor changes.

	Su Mo Tu We Th Fr Sa
Feb	                   1
	 2  3  4  5  6  7  8	first class
	 9 10 11 12 13 14 15	assignment 1 due
	16 17 18 19 20 21 22	assignment 2 due
	23 24 25 26 27 28	assignment 3 due
Mar	                   1
	 2  3  4  5  6  7  8	assignment 4 due
	 9 10 11 12 13 14 15	design doc due
	16 17 18 19 20 21 22	spring break
	23 24 25 26 27 28 29	assignment 5 due; weekly TA meetings start this week
	30 31
Apr	       1  2  3  4  5
	 6  7  8  9 10 11 12	project prototype
	13 14 15 16 17 18 19
	20 21 22 23 24 25 26	alpha test
	27 28 29 30
May	             1  2  3	last class; beta test
	 4  5  6  7  8  9 10	demo days
	11 12 13 14 15 16 17	Dean's date: projects due by 5pm
	18 19 20 21 22 23 24
	25 26 27 28 29 30 31

Course Summary

This is a course about the practice of programming, an attempt to expose students to the development of real programs. Programming is more than just writing code. Programmers must also assess tradeoffs, choose among design alternatives, debug and test, improve performance, and maintain software written by themselves and others. At the same time, they must be concerned with compatibility, robustness, and reliability, while meeting specifications. Students will have the opportunity to develop these skills by working on their own code and in group projects.

During the first half of the semester, there will be a programming assignment each week, which should take perhaps 5-6 hours to complete. During the second half of the semester, students will work in groups of 3 to 5 on a project that will involve a substantial amount of design and implementation.

COS 333 is about programming, not about a specific language. The course will assume that you are very familiar with C and Java, and will include excursions into C++ and scripting languages like shells, Awk, Python and Javascript. There will be significant emphasis on tools, both how to use them and how they are designed and built. Students must be comfortable with C and Java programming and with Unix, and able to write modest-sized programs that work. COS 217 and 226 are prerequisites.


This syllabus is always subject to change. Each topic will take roughly one week; there's no guarantee that we will cover all of them, nor in any particular order.

This is meant to be more than a laundry list, however. Each section will also discuss issues of design, implementation, testing, performance, portability, and other software engineering concerns, and these will also be part of the programming assignments. With luck there will be a handful of guest lecturers as well.

There is one required text: The Practice of Programming, by Kernighan and Pike; you should also know basic Unix tools and usage as described in, for example, The Unix Programming Environment. Other readings will be posted. The books listed in this bibliography are also worth looking at; they cover a wide variety of material related to programming.

Tuesday and Thursday 11:00-12:20, McCosh 10

Brian Kernighan, 311 CS Building, 609-258-2089, bwk at Depending on class size, I may set up regular office hours once things get rolling; alternatively, send mail to make an appointment, or just drop in if my door is open, which it usually is.

Teaching Assistants and office hours:
      Christopher Moretti (cmoretti) CS 206, Fri 1:00-2:00
      Deep Ghosh (soumyade) CS 226, Thu 7:30-8:30 (pm!)
      Raghav Sethi (raghavs) CS 003, Wed 2:00-3:00
      Taewook Oh (twoh) CS 226, Fri 2:00-3:00
      Xin Jin (xinjin) CS 316, Wed 3:30-4:30


Half a dozen programming exercises will be assigned during the first half of the term; each is intended to take about 5-6 hours, but is sure to take longer unless you are careful.

Assignments are together worth about 30-35 percent of the course grade. Assignments are generally due by midnight on Fridays unless there are extraordinary circumstances. For the record, extracurricular activities and heavy workloads in other classes don't count as "extraordinary", no matter how unexpected or important or time-consuming. Assignments will generally be posted on Tuesday and due at midnight on Friday 10 days later. This leaves enough time that we will not be able to grant extensions except in case of documented medical or other serious issues.

If you submit your work late, we will give you credit for it on this scale:


The second half of the semester will be devoted to a group project. The project can be done with whatever combination of languages and techniques makes most sense; one of the goals of the project is to encourage careful tradeoffs among alternatives, and planning of interfaces to minimize dependencies among components. The project is a good place to explore personal interests further than can reasonably be covered in class.

The project will have frequent checkpoints along the way for which you will have to prepare status reports, preliminary designs, and the like. There will be a public presentation and demo at the end, a written writeup, and submission of a system for testing and evaluation. All of these are graded.

The project will be worth about 60-65 percent of the course grade; it will be shared equally among group members, with the possibility of negative adjustments for members who fail to contribute their fair share.

You must complete all assignments and project requirements to pass the course. Furthermore, the class is so large that we don't have the resources to nag and make special arrangements; you are responsible for meeting all the requirements without reminders.


Attendance and participation is potentially worth up to 10 percent of the course grade. Attendance is mandatory; unexcused absences will be penalized.

Regular class attendance is required and class participation helps. Unexcused absences are grounds for a failing grade regardless of other performance. This means you.

Laptop Policy

Please, no laptops, phones or tablets except for taking notes and other class purposes. Regrettably, computers and phones appear to be primarily used for email, chat, YouTube, Twitter, Google, solitaire, poker, eBay, Facebook, and similarly compelling diversions, all of which distract you, your neighbors, and me. (Additions to this list are welcome; I can't keep up.)

Collaboration Policy for Assignments:

(This policy on collaboration in assignments is adapted from the COS 217 web page.) Programming, like composition, is an individual creative process. Individuals must reach their own understanding of the problem and discover a path to its solution. During this time, discussions with friends are encouraged. However, when the time comes to write the code that solves the problem, such discussions are no longer appropriate -- the program must be your own work (although you may ask teaching assistants for help in debugging). If you have a question about how to use some language or operating system feature, you can certainly ask your friends or the teaching assistants. The course newsgroup is also intended for sharing insights on the meaning of questions, terminology, and so on.

Do not, under any circumstances, copy another person's program for an assignment. Writing code for use by another person or using another person's code in any form violates the University's academic regulations.

Examples of unacceptable behavior for assignments include:

The program you turn in must be your work. You may get help from the instructor or a TA after you have started writing code, but not from other students. Computer science assignments are not like physics or math problem sets: there is no single right answer. Each student is expected to come up with his or her own individual solution.

If you plan to do something that you are not absolutely sure is legal, ask first. Ignorance of this policy will not be accepted as an excuse for your actions.

You are responsible for ensuring that your files are not readable by your classmates. We recommend doing your COS 333 assignments on your own machine or in a private subdirectory, i.e.:

	% mkdir cos333
	% chmod 700 cos333

Collaboration Policy for Projects:

Projects will often use open source code and other publicly available material as building blocks or as the basis for modification and adaptation. This is permitted and indeed encouraged, but such code must be properly attributed, and the project as a whole must be substantially your own work. Please consult with the instructor if you are uncertain about a proposed course of action.

Project groups are encouraged to share insights and information about how things work, how to get things done, and other aspects of programming knowledge.