Yale University Department of Computer Science
CS-112: Introduction to Programming (in Java)
Meeting time: | MWF 9:30am-10:20am |
Instructor: | Bradley C. Kuszmaul |
bradley@cs.yale.edu | |
AKW 202 | |
Office Hours: | By appointment (send email to Prof. Kuszmaul.) |
Course web page: | http://arch.cs.yale.edu/~bradley/cs112/ |
TA: | TBA |
TA Hours: | TBA |
This is an introductory programming course, using the Java programming language. There is no prerequisite for this course. No prior programming experience is required. (Alternative courses are listed on the separate handout: Introductory Computer Science Courses.) The course will teach you what computers are and a little about how they are put together and how they work. Not only will you get hands-on experience programming, but along the way you will get a taste of computer science, the academic discipline concerned with computers, algorithms, and computational processes.
To learn to program requires practice. Programs are creations that must be carefully designed and implemented to achieve a desired end. A program does not spring full-blown into life any more than does a symphony, a painting, or a cabinet. Rather, it is built step by step, starting from only a general outline of what the finished product will look like and gradually refining the design and filling in missing details along the way. Remember, it is not possible to do everything all at once. You won't know exactly what your finished program will look like when you start writing it, usually. Nevertheless, the only way to make progress is to get started and accept the fact that you will learn and make mistakes along the way.
A computer language is tool for building programs. To learn to use any tool well requires practice, and programming languages are among the most complex tools ever devised by humans. Learning to use a programming language well requires years of practice. Much of that practice on Java will carry over to other programming languages, such as C or FORTRAN. For this course, you will need to sit down at a computer regularly and work through the assigned problems. Don't feel you must restrict your programming to the assignments--often the best way to learn a new concept is to try it out and see what happens. Feel free to use the computer as a regular part of your studying, to answer questions you might have about how something really works, or just to get the ``feel'' of a new concept.
Don't be shy about getting started. A computer can be quite intimidating the first time you try it, and not knowing simple things (like where is the control key) can be embarrassing. But just go ahead anyway and try it, and ask for help when questions arise. Don't be afraid to make mistakes. There is little you can do (short of physical violence) to damage the machine, so feel free to experiment.
Each week there will be two lectures (Monday and Wednesday) and one recitation. New material will be presented in lectures. (This first week we will have an ordinary lecture on Friday September 5, however.)
For the recitations the class will be divided into three or four (one for the instructor and one for each TA) to meet in smaller groups. The recitations will be mostly to review homeworks and to answer questions.
The following text is required for the course, and should be available from the Yale Bookstore:
Java Gently, by Judy Bishop, Addison-Wesley, 1997.
We ordered 150 copies of the textbook, and the bookstore was able to actually obtain 102 copies.
The book does not exactly meet our needs, but it is acceptable. As a result you should attend lecture, or you may miss important topics.
Additional course materials are available on the course web page.
There will be weekly homework assignments. Often the weekly homework will be broken into several sub pieces due on different days. (For example, homework Assignment 1A will be due on one day, and homework Assignment 1B will be due two days later.) For the most part, these homeworks will be computer programs written in Java. Plan on spending between 6-8 hours per week on the course outside of class. You can't learn how to program without actually writing (and running) programs. The programming assignments form an integral part of this course. I expect that you will complete them all and turn them in on time. Don't fall behind, or you may never catch up.
There will be a midterm exam in class, and a comprehensive final exam. Both exams will be ``one-page-open-note.'' That means you can write all the notes you want on both sides of a single sheet of standard letter-size paper. The notes can either be prepared by hand, or they can be prepared on the computer and be printed on a printer. (If you think you can gain some sort of advantage by printing in a one-point font that can only be read with a magnifying glass, you are welcome to try it.) You will be required to turn in your one-page sheet of notes with the exam (you may have the notes back later if you want.) You may not use a computer during either examination.
The precise weighting of the various homeworks and exams will be determined by the teaching staff at the end of the semester. Our initial guess is that each homework will be given equal weight, the midterm exam will be worth four homework assignments, and the final exam will be worth eight homework assignments. The details of the weighting may change a little. If you do something particularly impressive it be given extra weight. Impress us!
You are allowed to work with other students, but you must give credit where credit is due. Each of you must turn in your own homework, and on that homework, you must list anyone who helped you on the homework, and explain how they helped. An example acknowledgment might look like this:
Acknowledgment
I wrote the program for this assignment, but it didn't work at first. Joe Blow showed me how to use the debugger, and we worked together to find and correct the problem. Joe also proofread the written part of this assignment.
Working together is good skill to learn and practice. You can do better work together than you can alone. In both industry and academia people usually work together, and anyone who contributes to a project should receive appropriate credit.
Some students may be tempted to avoid doing the homework by copying liberally from other students. That is a bad idea. If you do not do the homework, you will do poorly on the midterm and final exam. Also, why bother spending time on a course if you don't do the best you can? If you do not pull your own weight in a team, the other members of the team will eventually flush you. Get into the habit of pulling your own weight (and a little more), so that you will succeed in life.
We have programs that can analyze your programs for similarities to other students' programs. It turns out that it is easy to get caught copying others' work, which I will consider cheating if you don't acknowledge it. Cheaters will be prosecuted.
You are always free (and encouraged) to come in and ask the TA's or the instructor for help about anything concerning the course. Please also talk to me if you have any questions about this policy.
The Yale College policy on ``Use of Computers and Postponement of Work'' in the Yale College Programs of Study, applies to this course. It is reproduced below.
Problems that may arise from the use of computers, software, and printers normally are not considered legitimate reasons for the postponement of work. A student who uses computers is responsible for operating them properly and completing work on time. (It is expected that a student will exercise reasonable prudence to safeguard materials, including saving data on removable disks at frequent intervals and making duplicate copies of work files.) Any computer work should be completed well in advance of the deadline in order to avoid last-minute technical problems as well as delays caused by heavy demand on shared computer resources in Yale College.
Particularly relevant for this course are the cautions against leaving a programming assignment to the last minute when machines might be busy, printers broken, and so forth, and about safeguarding your data.
Using the Java programming language, we will present a range of programming topics including control structures, object-oriented programming, arrays, strings, graphics, exception handling, threads, input/output streams, and networking.
As a bonus, we will briefly cover HTML - the HyperText Markup Language used for Web authoring. Actually, HTML is not a language at all, at least in the programming sense of the word. You will write one Java applet to put on a web page.
We will touch on many additional topics including software engineering, security, artificial intelligence, and Internet lore and culture.
You may have heard of programming languages such as BASIC, C, C++, or FORTRAN. You may have heard some of the hype about Java. These are all programming languages. The C and FORTRAN languages are taught in CS 130, and C is used in CS 210. It is commonly assumed that certain programming languages are good for certain tasks. For example, that physicists should use FORTRAN. People often think of learning programming languages as being similar to learning a natural language, such as French or German. Programming languages are more similar to each other than are natural languages, however. Being fluent in French does not very much help you learn German. Once you know one programming language, it is much easier to learn another one, however. Learning to program is less like studying a foreign language than like learning to drive. Once you learn to drive a Ford, you will have little trouble driving a Honda or a BMW.
Just like most automobiles have steering wheels, brakes, and turn signals, most programming languages share a common set of features, including variables, arithmetic instructions, linguistic structures for grouping data, and a way to express control flow. Some languages don't have all of the ``standard'' features. For example FORTH and PostScript mostly do away with variables. The Lambda calculus has no arithmetic. Assembly language usually has no data-grouping syntax. Functional languages often have no control flow. For a fun sampling of the rich variety of programming languages that exist, take a look at all the programs to emit the lyrics of 99 Bottles of Beer. Java, on the other hand, is a robust, modern language with the equivalent of automatic transmission, power windows, leather interior, and a cell phone. People seem to like the features.
Java has many attractive characteristics, including the following.
This course will make extensive use of Yale's computer networks and the Internet.
The standard platform for our examples will be unix machines. You all should have accounts on the pantheon. You may also obtain accounts on the Yale Engineering Cluster (which provides Unix and Windows machines) or you may use the Windows or Mac machines which are distributed around campus. You may also use your own machine. We recommend that you all get accounts on the engineering cluster so and congregate in the garage to help each other get over the rough spots along the way. Also, for at least one homework you will need access to an X-server, so you will either need to install X on your computer or use one of the machines on campus that provides X (e.g. the machines in the engineering cluster.) To turn in your homework you will use a homework submission program that runs on the pantheon, so make sure you now what your password and netid are for the pantheon.
You are allowed to use any other programming environment you want, however. For example, you may use a Mac, or a Wintel machine, or a Linux machine, or whatever. Java is supposed to be portable, after all. If you use another machine, you will need to copy your homework to the pantheon (for example, using ftp or rcp or, best of all, scp) and then on the pantheon you will need to run the homework submission program. More about the homework submission program later.
Your programs must run on the pantheon's Java systems! If there are any incompatibilities between your Java and the pantheon's Java, we must insist on using the pantheon's Java. You should double check that your programs run under the pantheon's Java before turning them in. On the pantheon you will need to add the following to your path:
/usr/licensed/javasoft/jdk1.1/bin/
Reading: Chapter 1 of Bishop (in particular, pay attention to Page 9, which explains how to use javac and java.)
This is a three-part assignment.
Reading: Bishop Chapter 2 through page 16.
More reading: For this part of the assignment you will run the emacs editor tutorial. If you are using some other machine to perform code development, this part of the assignment is optional. You should learn to use a real text editor even if you plan to use a mac or wintel box. On a unix machine client, run the emacs program:
emacsNext, type control-h t. (The control key is like the shift key: To type control-h you press down on the control key, then you press down on the h key, then you lift up on the h key, then you lift up on the control key.) Read the tutorial, and follow the instructions. You might not want to run the whole tutorial on your first time out. Concentrate on gaining enough skills to create a simple program and save it out to a file.
Hacking: Create a file named hw1a.text in your home directory on the pantheon. The contents of the file should be your name. Submit the file using the online homework submission program. (Information on how to submit homework on the pantheon will be available ASAP.)
Hacking: Create the ``Welcome'' program in Figure 2.1 of Bishop, get it working and submit it. (If you do this on the pantheon, you will need to learn to use an editor. If you do this on your own machine, you will need to learn how to transfer files to the pantheon and then submit them. Hence, if you skip the optional emacs tutorial because you are using another machine, you will pay the price by having to learn about file transfer and remote login.)
Reading: Bishop, Page 259-262. (Don't bother reading this until after we cover it in class on Monday September 8.)
Hacking: Convert your ``Welcome'' program into a Java applet. Bishop, pages 259-262 shows how to do this by example. We will also cover the details in class on Monday September 8.
This document was generated using the LaTeX2HTML translator Version 96.1-h (September 30, 1996) Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
The command line arguments were:
latex2html -t handout0-syllabus.tex -no_navigation -split 0 -dir handout0-syllabus.htmldir handout0-syllabus.tex.
The translation was initiated by Bradley C. Kuszmaul on Tue Sep 2 15:12:39 EDT 1997