CS 21: The Imperative Paradigm: Unix and C
Spring Semester 2005
Swarthmore College
Section 1
TR 2:40-3:55, Sci. Center 240
Professor: Tia Newhall
Office hours:
Office: 249 Science Center
|
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
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
-
Read the material before you come to class.
Don't worry about total comprehension, but at least get a feel for
what we will be covering that week. If you have some understanding of
the material coming into class, it will be easier for you to ask
questions during class, rather than later when help may not be
available. Additionally, we often do lab exercises during class. This
is an important part of the learning process, as these exercises give
you immediate experience with the material we are covering. If you
read the book before you come to class, you'll be able to complete
these exercises more easily.
-
Ask questions if you don't understand.
This means both during class and while doing your homework. This class
continually builds on previous material, so if you don't understand
something one week, it will continue to be a problem the next week,
and the week after that, and so on. If you need help, ask your classmates
(make sure you have read the "Homework Scenarios" section below first),
attend the clinics, come talk with me during my office hours, or
email me your question.
-
Start the homework assignments early.
I realize this one is not always easy to do, but if you can get in the
habit of doing this, you will be much better off. If you get
stuck early (i.e., not two hours before it is due), there will be time
to look for help. In addition, if you start early enough, you can
take a break, go do something else, and come back later. I find I
always have at least a few new ideas when I come back to a problem
after a break. If you wait until the last minute, you can't do this.
-
Practice, practice, practice.
The only effective way to
learn the material and pass the exams is to consistently do the
homework. Finish all of the assigned programs (and do some extras,
for fun!). Even if you don't get them done on time, they will still
help you learn the material.
-
Seek help early and often.
Because course material builds
on previous material, it is essential to your success in this class
that you keep up with the course material. If you are having difficulty
with a programming assignment, if you didn't follow something covered
in lecture, if you feel you need some extra help understanding or
practicing some of the course material, or if you just want to discuss
something from a lecture, an assignment, or the text, please come to
my office hours. Also, CS21 clinicians are available to help you
with programming assignments during
CS21 clinic hours each week.
20% Exam 1: Thursday, Feb. 24 (in class exam)
20% Exam 2: Thursday, April 7, 7-9pm in SCI 101
25% Exam 3: 9:00-12:00 May 14th in SCI 199
30% Homework
5% Class Participation and Quizzes
Homework
Homework will generally be assigned on Tuesdays, and will be due the
following Sunday 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.
These are OK:
- Late Thursday night, after working for a few hours on this week's
CS21 homework, you realize you are stuck on one particular function.
Instead of working more, and possibly not making any progress, you
decide to get a good night's sleep and visit your instructor during
office hours the next day.
- After working on a program for a few hours, you realize you are
stuck with one particular concept. You look around the CS Lab,
find someone in the class, and ask them for help. After explaining
what you are trying to do, your classmate points out a flaw in
your idea, and gets you started in a new direction. After successfully
completing the program, you add a comment at the top of the code
stating who you received help from.
- You had trouble with the last homework assignment, so you ask
someone in class if they would like to work as a team on this
week's assignment. You get together well before the assignment
is due, and discuss the first program. After figuring out a
reasonable algorithm, you work together to type in the program
and debug it. When you are finished with the program, you put
both of your names in the comments at the top, and turn it
in as a team.
These are definitely NOT OK:
- No matter what you do, you can't seem to get your program to work and
are getting very frustrated. A friend of yours comes into the CS Lab
who you know has already finished this week's homework. You ask her
for help, but since she is busy working on an assignment in another
class, she offers to print out a copy of her code for you to look at.
- After working on a program for a few hours, you realize you are
not making any progress with one particular function. As no one
is around to ask for help, you take a look at your friend's
program in his home directory, to see how he wrote the function.
- Late Sunday night, after just starting this week's CS21 homework a few
hours ago, you realize you will never finish before the deadline.
After searching through many directories, you finally locate
another student's homework and copy it to your home directory.
After modifying a few comments, you turn in the copied program as your
own.
Clinics
Each week we will have CS21 clinics in the main CS Lab
at the following times:
- Thursday 7-9pm, clinician Alex Benn
- Saturday 1-4pm, clinician Megan Schuster
- Sunday 2-4 pm, clinician E.B. Fouts
During clinic hours, the clinician
is 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
| 1/17
| Introduction to C Programming
| 1, 2
| Using Unix I:
Tues, Jan 18, 4-5pm
Tues, Jan 18, 7:30-8:30pm (repeat session)
Clinics start Thursday night
| Tues
Thurs
| hw1
hw2
|
2
| 1/24
| Problem Solving
| 3, 4
| Add/Drop ends 1/28
Using UnixII
Tues, Jan 25, 4-5pm
Tues, Jan 25, 7:30-8:30pm (repeat session)
| Tues
Thurs
| hw3
|
3
| 1/31
| Functions and Debugging
| 5, 6
|
C Code Style Guide (read "Function Comments" and "Line Length" parts)
| Tues
| hw4
|
4
| 2/7
| Libraries and Graphics
Libraries and Random Numbers
| 7, 8
| -
| Tues
Thurs
| hw5
|
5
| 2/14
| Arrays
| 11
| -
| Tues
Thurs
| hw6
|
6
| 2/21
| Arrays
| 11
| Exam 1, Thursday in class
Exam 1 Topics
Tia's office hours this week: Tues 4-5pm, Wed 1-2pm
| -
| hw7
|
7
| 2/28
| Searching, Sorting, and Analysis of Algorithms
| 12, 17.3
| -
| Tues
Thurs
| hw8
|
-
| -
| Spring Break
| -
| Spring Break
| -
| -
|
8
| 3/14
| Pointers
| 13
Pointers
| -
| Tues
Thurs
| -
|
9
| 3/21
| Pointers cont.
| -
| -
| Tues and Thurs
| hw9
|
10
| 3/28
| Characters and Strings
| 9.2, 14
chars
strings
| -
| Tues
Thurs
| hw10
|
11
| 4/4
| Reading and writing files, makefiles
| 15
file I/O
| Exam 2, Thursday evening
7-9pm in SCI 101
Exam 2 Topics
| Tues
| hw11
|
12
| 4/11
| Records
note: there are many ways to define structs in C.
You should define them the way I do in class rather than the way the
book does it.
| 16
| -
|
Tues & Thurs
| -
|
13
| 4/18
| Linked Lists
| 17.2, handouts
Linked Lists
| -
| Tues
| hw12
|
14
| 4/25
| Binary Trees
| Binary Search Trees
| -
| Tues
| -
|
Finals
| -
| -
| -
| Exam 3, 9:00-12:00 am May 14th in SCI 199
Exam 3 Topics
Exam 3 Review Sessions:
Wed May 11, 5:30-6:30 in the CS Lab (Tia)
| -
| -
|
On-line References
- cs21handin: how to use the cs21handin program to turn in assignments.
- useful Unix commands: handout from the first day of class.
- C Code Style Guide Read this early and often.
- Safe File Sharing for Group Projects
- my C documentation
- CS Deptpartment's Unix Help Pages
- My Unix Documentation make, tar, cvs, rcs, debugging tools, editors, email,
protecting and sharing files, C style guide, ...
- Compiling, Linking and Debugging Tips for C
- Recovering Lost Files What to do if you accidentally delete a file