May 21, 2004
Computers do many of the same things people do, only faster, more accurately, and without getting bored. Accordingly, the task of programming a computer is essentially the task of figuring out exactly how you would solve a particular problem, and then explaining it to the computer. Unfortunately, computers are literal-minded and completely devoid of intuition, so your explanation must be much more precise and unambiguous than if you were explaining things to a human being. This course, therefore, is about how to analyze a problem, figure out precisely and unambiguously how to solve it, and present this explanation to a computer.
In a broader sense, this course is about problem-solving, and about a particular way of approaching the world which we may call algorithmic thinking. I consider computer science a ``liberal art'' providing training in how to think, regardless of whether you choose it as a profession.
This course is intended primarily for people who have not previously studied computer programming. For non-CS-majors, this course counts towards your math/science distribution requirement. For math majors, this course fulfills your programming requirement. This course does not count as part of the CS or CMIS major, although personally I think most CS and CMIS majors would learn a lot from it. Students who have passed at least a semester (half a year) of computer programming with a ``B'' or better may skip this course and go straight to CSC 171, or they may take this course anyway; some of the concepts will be familiar, but they'll probably still learn a lot.
If you're curious about how computers work, what programming is like, and how programmers think, this is a good course to take. If you have no interest in writing programs of your own, but simply want to use Web browsers and search engines, spreadsheets, databases, word processors, etc. and perhaps write your own Web pages, you should take CSC 170 instead.
This course has no prerequisites. Students are not expected to know anything about programming, although students who have done some programming in a different language may still benefit from the course; consult the professor. In any case, it would be helpful if you knew how to use e-mail and a Web browser.
Although the course has no prerequisites, and is considered suitable for General Education distribution requirements, it is nonetheless hard work. Lectures will not cover everything you need in order to complete the homework assignments; you need to read the textbook too. There will be (probably) one homework assignment per week, most of which will require hours of programming, either in a computer lab or at your home computer.
What distinguises a ``good program'' from a ``bad program''? Obviously, a good program has to work correctly and reliably -- a difficult goal in itself, as we'll see. But this is far from enough. In practice, very few programs are written once, used for a while, and discarded: much more often, a program is used until the need for it changes, the program is modified to handle the new requirements, the modified program is used for a while, and the cycle repeats. Thus a ``good program'' must be not only correct the first time around, but structured in such a way that it can easily be modified to accomodate likely changes in requirements. We'll study how to design such programs.
A first programming course is in some sense an almost impossible task. In one semester, you'll be asked to learn several different kinds of knowledge:
How to use the computers and the software on them
The grammar, punctuation, and vocabulary of a programming language
How to analyze a problem and design a program to solve it, so that the program is both correct and easy to write, read, modify, and repair
How to plan your time, and what sequence of steps to go through, in designing, writing, testing and debugging a program
Application-specific knowledge (e.g. to write a program that draws geometric shapes on the screen, you have to know something about geometry.)
It is easy for a student (or a professor or a textbook author, for that matter) to get caught up in the details of the first two at the expense of the rest. I urge you not to fall into this trap, because the specific kinds of computers and software, and to some extent the language, you learn this semester will almost certainly be obsolete by the time you leave Adelphi. The much more interesting and lasting knowledge is at levels 3, 4, and 5 (and I'll try to minimize the time we spend on level 5 because it's not specific to computer science). In short, although all five kinds of knowledge are necessary in order to write a good program, I'll try to concentrate on levels 3 and 4.
Programming a computer requires that, to some extent, you learn the computer's language. Computers ``understand'' a lot of different languages, and the choice of language affects how you approach programming. I've taught beginning programming in a number of different languages -- Pascal, C++, Java -- but to my mind most of them require spending far too much class time on level-1 and level-2 knowledge, with not enough time left for levels 3 and 4. So in this course we start students in the simple, easy-to-use Scheme language; after you've got a firm understanding of the concepts, you'll be prepared to take another programming course in a more complicated language like Java or C++.
We'll pay a lot of attention to design patterns, which are step-by-step ``recipes'' for getting from a vague English-language description of a problem to a working computer program. Every year, some students skip the recipes when they're in a hurry, and invariably find themselves wasting more time as a result. To prevent this, you will be graded on, among other things, how well and thoroughly you use the recipes.
We'll use the textbook How to Design Programs, by Felleisen, Findler, Flatt, and Krishnamurthi (who also wrote the programming platform we'll use, DrScheme). This book is available in the bookstore, but you don't have to buy it because it's also available on the Web at http://www.htdp.org/
You'll need to read, on average, around 15-20 pages between each lecture and the next. You are responsible for everything in the reading assignments, whether or not I discuss it in a lecture. You are also responsible for checking my class Web page every day or so; I often post assignments, corrections to assignments, solutions to assignments, etc. there.
I expect to give five homework assignments, each due three (class) days later. Most assignments are to be turned in by email, and will be considered late if the time stamp on the email is after midnight on the assigned due date. Assignments will lose credit per day late, so if you've got the choice between turning in an incomplete program today and a better one tomorrow, turn it in today unless you think you'll improve it by more than . Any homework assignment turned in after midnight, Wedneaday, June 23 (the day before the final exam) will get a zero.
We'll have a two-hour final exam at the usual time, in the usual classroom, on June 24. It will be weighted the same as one programming assignment. There will also be a ``brownie points'' grade, weighted the same as a programming assignment. The final exam must be taken at the scheduled time, unless arranged in advance or prevented by a documented medical or family emergency. Exams not taken without one of the above excuses will be recorded with a grade of 0.
Every program must contain, in the first few lines, a comment indicating the name(s) of the student(s) working on it and which assignment it is. Programs not containing this information, clearly visible, will get a zero.
Every program must be accompanied by test cases, so I can see how it actually works. Programs with inadequate or poorly-chosen test cases will lose points (we'll discuss how to choose good test cases); programs turned in with no test runs at all will lose lots of points.
Having done my share of programming, I know that sometimes you hit a brick wall and cannot get the thing to work for love or money. If this happens, turn in the program together with a detailed description of how the program fails, what you've tried in your attempts to fix it, and how those attempts didn't succeed. You won't get full credit, but if I'm convinced that you're working on it diligently, you'll get partial credit. Note that ``how the program fails'' does not mean saying ``I got an error message'': you need to tell me which error message you got, when you saw it, and what you think the error message means. Similarly, if the program fails by producing wrong answers, you need to tell me when it produces wrong answers (are they all wrong, or just in a few cases?), how they are wrong (e.g. are all the numbers consistently higher than you expected, are they the negatives of the correct answers, or are they all over the place with no apparent pattern?), and your speculations on how such an error might have arisen. I ask all this not because I'm mean and horrible, but because by the time you've written all this down, you may have enough information to actually fix the problem, which is much better than turning it in incomplete.
I also expect you to maintain a log of what kinds of errors you encountered, how you discovered them, how long it took you to fix them, and what the actual problem was. This log must be turned in with each homework assignment. I've written some Web-based forms to make it easy to record this stuff, or you may just keep track of it yourself on paper or in a text file.
The Adelphi University Code of Academic Honesty is on the Web at http://academics.adelphi.edu/policies/honesty.php ; please read it.
How does it apply to this course? Most homework assignments in this course involve writing, testing, and debugging one or more programs. You are encouraged to discuss homework assignments with your classmates, and help one another with low-level things like "what does this error message mean?", but not to copy code from one another. It's really easy to spot copying in a class of seven students....
All work on the final exam and the quizzes must be entirely the work of the one person whose name is at the top of the page. If I have evidence that one student copied from another on an exam or quiz, both students will be penalized.
This class meets every Monday, Tuesday, Wednesday, and Thursday from 10:40 AM to 12:40 PM in Hagedorn 110.
All dates in the schedule are tentative, except those fixed by the University; if some topic listed here as taking one lecture in fact takes two lectures to cover adequately, or vice versa, the schedule will shift. I'll try to keep this information up to date on the class Web page.
I expect you to have read the reading assignments before the lecture that deals with that topic. This way I can concentrate my time on answering questions and clarifying subtle or difficult points in the textbook, rather than on reading the textbook to you, which will bore both of us. Please read ahead!
When I say ``read'' above, I mean an active process, involving not only the textbook but pencil, scratch paper, and a notebook for writing down key points. Finally, and perhaps most importantly, you'll need a computer for trying out the new ideas you find in your reading. Just as you cannot learn about cooking or driving a car just by reading about it, you cannot learn about programming just by reading about it. In short, every time you read about a new programming idea, try it! The How to Design Programs textbook contains lots of exercises, which you are encouraged to do as you come to them in the text, whether assigned as homework or not.