CS 21: The Imperative Paradigm: Unix and C

Fall Semester 2004
Swarthmore College

Professor: Tia Newhall
Section 1: TR 9:55-11:10, Sci. Center 240
Section 2: TR 2:40-3:55, Sci. Center 240
Email:
Office: 249 Science Center
Phone: 690-5637
Office hours: 2:30-3:30 W, 3:00-4:00 F, and by appointment

Contents

Course Description, Text
Class Schedule Topics, Readings, Assignments, Due Dates
How to Succeed in CS21
Grading
Homework
About the CS Lab
Academic Integrity
Clinics
Links to Unix and C help

Course Description

This course introduces students to fundamental ideas in computer science using the C programming language and the Unix operating system environment. Class periods will consist of a combination of lectures and hands-on interaction at the computer. Topics to be covered include an overview of the Unix operating system, elementary Unix tools, modular software design, recursion and iteration, sorting and searching, abstract data types and their representations, lists, trees, informal analysis of algorithms, and a thorough introduction to C programming, including control structures, functions and procedural abstraction, libraries and modules, arrays, pointers, string manipulation, file processing, and records.

We will be paying particular attention to developing a good programming style. Your homework grade will be strongly influenced by the legibility of your code, so it is very important to develop a clear, logical, aesthetically pleasing programming style, making judicious use (but not overuse) of comments, whitespace, well-chosen variable names, and a consistent indentation style. There will be numerous programming assignments illustrating the concepts covered in class.

Text

The required textbook for the course is The Art and Science of C: An Introduction to Computer Science, by Eric S. Roberts

There are also many C language references in the CS lab that you may use while you work in the lab (you may not remove them from the lab).

How to Succeed in CS21


Grading

20% Exam 1: Thurs. 9/30 (in class)
20% Exam 2: Thurs. 11/11 (in class)
25% Exam 3: Friday Dec. 10, 7-10pm, room 101 Sci. Center
30% Homework
5% Class Participation and Quizzes


Homework

Homework will generally be assigned on Tuesdays, and will be due the following Monday by 11:30pm. Typically, each assignment will consist of several separate programs. Only one of these programs will be graded (you will not know which one in advance). If you do not submit the program that is selected for grading, you will receive a zero for the assignment. Some homework assignments may have optional problems that you can complete for extra credit points.

Your homework assignments will be turned in electronically, using a special cs21handin program (to be explained in class). Late homework is not accepted. However, if you miss a deadline, you are strongly encouraged to complete the assignment anyway, since this really is the only effective way to learn the material.

Because many students feel they learn more through collaboration, you may work jointly with one other person on some designated assignments (although you may work alone if you wish). No more than two people should work together. If you work with someone else, you must submit a single, joint assignment with both names clearly indicated at the top of your program file(s). I will let you know which assignments you are allowed to collaborate on.

Homework assignments will be given a numerical grade according to the criteria shown below. Note that a program that works 100% correctly gets a 3. In order to get an 4, your program also needs to be clearly organized and well-documented (but this doesn't mean over-documented!). The numerical grades will be scaled in some way so that the difference between a 4 and a 3 is more like the difference between an A and a B grade.

4 correct, logically designed, well-documented, efficient
3 correct, but has stylistic problems
2 partially correct
1 does not compile or execute

If there are known problems with your code, you should describe these problems in a comment at the top of your program file.

About the CS Lab

The CS Lab (room 240) and the overflow lab (room 238) are open 24 hours a day for CS students to work on their course assignments. When the CS Lab is in use by a class, you should work in the overflow lab.

We will distribute MicroProx tags to attach to your student ID sometime in the first or second week of classes. These will allow you entry to the CS Lab and entry into the Science Center after building hours. You should use the door between Martin and Cornell to get into the building after midnight.


Academic Integrity

The College's Judiciary Committee (CJC) handles plagiarism offenses. The penalties for plagiarism are quite severe: usually the first offense leads to failure in the course, but it may additionally result in suspension. The following constitutes plagiarism on CS programming assignments:

Under no circumstances may you hand in work done with (or by) someone else under your own name. Your code should never be shared with anyone; you may not examine or use code belonging to someone else, nor may you let anyone else look at or make a copy of your code. This includes sharing solutions after the due date of the assignment. Failure to abide by these rules constitutes academic dishonesty and will lead to a hearing of the College Judiciary Committee.

The exception is that you may use code that the instructors have distributed in class and code from the book (you should cite this code as coming from the instructor or from the book). Also, if you work with a partner, then you and your partner may share code for the particular assignment on which you work jointly (again, both your names must appear in the comment at the top of the file). Additionally, CS21 clinicians are allowed to help you with your code.

Discussing ideas and approaches to problems with others on a general level is fine (in fact, we encourage you to discuss general strategies with each other), but you should never read anyone else's code or let anyone else read your code. If you are in doubt about some help that you received, then credit the person(s) from whom you got help and discuss the situation with your instructor.

For some examples of what we consider "okay" and "not okay" collaboration, look at the scenarios below.

Homework Scenarios

These are OK:

These are definitely NOT OK:


Clinics

Each week we will have CS21 clinics in the Sun Lab at the following times:

During clinic hours there will be a clinician (a student who has previously taken this course) available to help with your weekly programming assignments.


Schedule

Answers to Review Questions from homework assignments

WEEK DATES TOPIC READING ANNOUNCEMENTS IN-CLASS HOMEWORK
1 8/31, 9/2 Introduction to C Programming 1, 2 Using Unix I:
Tues. 4-5pm or
Wed. 8-9pm (in CS lab)
Tues
Thurs
hw1
hw2
2 9/7, 9/9 Problem Solving 3, 4 Add/Drop ends 9/10
Using UnixII
Tues. 4-5pm or
Wed. 8-9pm

C Code Style Guide (look at "Line Length" for tips on how to not wrap lines)

Tues
Thurs
hw3
3 9/14, 9/16 Functions and Debugging 5, 6 - Tues hw4
4 9/21, 9/23 Libraries and Graphics
Libraries and Random Numbers
7, 8 - Tues hw5
5 9/28, 9/30 More Random Numbers 8 Exam 1 Thurs. 9/30
Exam 1 Topics
Tips for taking Exams
Tues hw6
6 10/5, 10/7 Arrays 11 - Tues
Thurs
hw7
Read C Style Guide about commenting functions: C Style Guide
- - Fall Break - Fall Break - -
7 10/19, 10/21 Searching, Sorting, and Analysis of Algorithms 12, 17.3 Clinic Tues. 6:30-9:30
no Thursday clinic this week
Tues
Thurs
hw8
8 10/26, 10/28 Pointers 13 - Tues
Thurs
-
9 11/2, 11/4 Pointers cont.
Characters and Strings
9.2, 14
Pointers
- T&TH hw9
10 11/9, 11/11 Characters and Strings 9.2, 14
chars
strings
Exam 2 Thurs. 11/11
Exam 2 topics
Office Hours: Tues: 4-5, Fri: 3-4
- -
11 11/16, 11/18 Reading and writing files, using make files 15 - chars
strings
Tues
file I/O
Thurs
hw10
Part 2 due Wed. Dec. 1
12 11/23 Records 16 Thanksgiving vacation 11/25 Tues -
13 11/30, 12/2 Linked Lists 17.2, handouts
Linked Lists
- Tues
Thurs
hw11
extra clinic hours:
Mon Dec. 6 7:30-10:30pm
Tues. Dec. 7, 7-9pm
14 12/7 Binary Trees - Final Exam: Dec. 10th, 7-10pm, room 101 Sci. Center
Exam 3 Topics
- -


On-line References