As a non-credit course,
this course is named
Java Basics for New Programmers
X52.9238.
As a credit course in the Mcghee Division, it is named
Java Basics: Introduction to Programming Using Java
Y12.1007.
The course home page is
http://i5.nyu.edu/~mm64/x52.9238/
The previous home page was
http://www.it.scps.nyu.edu/~sultans/java/
A less direct way to get to these pages is via NYU Blackboard,
to which you can log in with your NYU
NetID
at
http://www.home.nyu.edu/
The course is offered by
New York University
School of Continuing and Professional Studies
Department
of Information Technologies
This document contains only an outline of the topics covered.
The entire content of the course is online at
http://oit2.scps.nyu.edu/~meretzkm/x52.9238/
The current version of this document
(February 27, 2007)
is online at
http://i5.nyu.edu/~mm64/x52.9238/syllabus.html
If you are reading a copy from any other source,
it may be out of date.
Mark Meretzky
has no office,
and hence no office hours,
but answers questions via
email.
He has taught C, C++, Java, Javascript, Unix, Networking, and Calculus at NYU.
He is also one of the operators of the
planetarium
in Westchester.
mark.meretzky@nyu.edu
http://i5.nyu.edu/~mm64/
The previous instructor was Sam Sultan.
If you have no prior programming experience, you can begin learning Java with this course. Get the fundamental concepts of object-oriented programming and the Java programming language. Understand Javas write-once, run-anywhere philosophy and the Java Virtual Machine, which allows any Java program to run on different platforms. Learn how Java handles data types, constants and variables, flow controls, program input and output, exceptions, and graphical user interfaces. Reinforce these new concepts with hands-on exercises, and complete your first Java programming project. Corequisite: Students who do not have Eclipse installed on their computer must take Java Environment Prep/X52.9263 along with this course.
The student must understand English and come to class. The course requires no previous knowledge of any programming language. For some students, Java will be their first language. I envy them.
See the corequisite in the above catalog description.
The core of the certificate can be taken as the massive, 96-hour, twice-a-week Java Programming Intensive X52.9279. Equivalently, the material can be covered in three shorter courses: Java I X52.9269, Java II X52.9271, and Object-Oriented Analysis and Design X52.9267.
If you have programmed in another language, you should take Java Express for Programmers Transitioning to Java X52.9276 before the core course(s). If you have never programmed in any language, you should take Java Basics for New Programmers X52.9238. This is not necessarily a disadvantage; many of our most creative students come from other fields.
To set up an appointment with an advisor, please call (212) 998–7171.
Our Java programs will run in an development framework named Eclipse, available free on the web. You will need a PC or a Mac to run this application. If your PC or Mac is a laptop, you can bring it to class and follow along.
If you have no computer at all, you can use the NYU labs on campus. If you do this, you will have to download a fresh copy of Eclipse and the SWT each time you go there. Youll get a lot of practice.
The textbook is The Java Programming Language, Fourth Edition, by Ken Arnold, James Gosling, and David Holmes. The examples we do in class are available free on the course home page.
There are no exams. I can serve you better by using all 30 hours of class time to tell you about Java and to entertain questions.
There will be many individual homeworks, all of them Java programs. For each program, hand in the source code itself (the .java file) and the output thereof on paper, one week after it was assigned. Please do not email me your homework—I dont want to have to print it for you. I will return each homework to you one week after you hand it in, with every error corrected. (Eager beavers can have their homework corrected and returned to them on the night they hand it in, during the intermission.) I may hand out some of the answers on paper in class. If so, you get no credit for an assignment that you hand in after I hand out the answer. (Assignments handed in after I give out the answers are invariably copies of my answers.) You get only one chance to hand in each problem. Write your real name on each page you hand in, or staple them together and write your name on the first page.
I post each weeks homework on the course home page the morning after each lecture. Whether you are present or absent, you should check the home page each week to find out what the homework was, and to see if any errors were discovered in the course materials.
Your grade will be based on the homeworks. If you do the homeworks correctly, you get a good grade. If you do the homeworks incorrectly, you get a bad grade. For example, if less than 50% of your homeworks produce the correct output, you will fail the course. (I mention this only for legal reasons. In real life, no one ever comes close to having only 50% of their homeworks produce the correct output. Everyone does almost all the coursework or almost none of it.) Note that a program must run in order to produce the correct output, or indeed any output at all.
To collaborate with one or two other people, you may collectively hand in one copy of every assignment with the names of the two or three authors. You must stay with the same partner(s) throughout the semester, and you will all receive the same grade. In the real world you will program with other people, so I encourage you to do so now. Two people usually do a better job than one; its also less work for me to read.
You must do all your own work with no help from anyone except your partner(s), if any. If I receive multiple copies of the same work from people who are not partners, the person whose name comes first alphabetically gets full credit, and the other people get no credit. After youre caught, it is too late to make the other person your partner. You will also fail the course if you hand in copies of my answers, or anybody elses answers. Plagiarists are subject to the ridicule of their teacher and peers.
I reiterate my bold claim that I will catch and correct every error in every homework for you, one week after you hand it in. But I will not give a grade to each individual homework. The only grade you will receive will be for the entire course. I grade on a curve. This means that your grade depends partly on how well everyone else does during the course, so it is impossible to predict before the end of the course.
I will not tell you your grade. I mail the grades to NYU immediately after the last lecture of the course, or when I receive the grading sheet from NYU, whichever comes last. I dont know how long it will take NYU to make your grade available to you. They will provide a printed transcript.
SCPS dean Carl F. Lebowitz says Incomplete grades should be given only in rare circumstances where a student has been able to complete nearly all of the course assignments by the end of the semester and has submitted the Incomplete Contract in advance regarding the situation. NYU also says that to receive a passing grade, students must attend 80% of the course.
A computer is a machine that follows a list of instructions. In the future, this list—called a program—will be written in English. But that day has not yet come. For the time being, we have to program in simpler languages. One of them is Java.
Any course for programmers has to begin with certain basics. How do we get the program into the computer? How can we save it, print it, and tell the computer to execute it? How does the input get into the program? Where did the output go? We will run our Java programs within a development environment called Eclipse. This application will provide the windows in which the programs and their output appear.
A course for first-time programmers has an additional set of basics. What are the instructions that the computer is capable of executing? How do we tell the computer to repeat them or selectively skip them, group them together and recombine them?
Programming is the art of building big things out of smaller ones, more complicated behaviors out of simpler ones. If we had a program that could add up a column of numbers, and another that could perform division and give us the quotient, we could compute the average of the column. If we could do division and get a remainder, and hold a list of twelve animals, we could figure out the current Chinese year. (2007 is the year of the pig. Its always the year of the pig when the year divided by 12 has a remainder of 3.)
In Java, we build up more complicated structures by packaging them as objects. The tasks that each object can perform are called its methods; the objects coöperate by sending each other messages. Higher-functioning classes of objects can be created using inheritance.
In addition to these topics in object-oriented programming, we will also cover the Standard Widget Toolkit (SWT). The widgets are objects that represent pushbuttons and scrollbars, blanks to fill in, and windows to draw on. They let our Java programs receive stimuli such as mouse moves and key strokes; display images, sounds, and video; and pop up menus, dialog boxes, and warnings.
By default, a computer executes the statements of a program from top to bottom. Control structure statements let the computer deviate from this order, sending it into jumps, loops, and spirals. The presence of control structure is what separates a computer from a calculator. It gives computer programming its distinctive flavor. We do it as early as possible because its so much fun.
We did a few simple calculations when we cooked the turkey; now we fill in the critical details. What is the value of 1 – 2 + 3? Is it positive 2 or negative 4?
Methods are called functions or subroutines in other languages. They were originally designed to consolidate repetitious sections of code. In Java, they will be the mechanism by which objects communicate with each other. We have had a method all along (the main method). But since there was only one of them, we werent really aware of it. Now we will have many.
An object is a way of packaging together a set of variables and the instructions that operate on them. We might have an object that contains a month, day, and year, or one that contains a first name and a last name. We have had a class all along. But since there was only one of them, and since there were no objects of that class, we werent really aware of it. Now we will have many.
Inheritance is one way of building bigger classes out of smaller ones. It lets us create a new class of objects with a head start. We can say that the new class (the subclass) begins by having all the features of an existing class (the superclass), plus the following additional features. This lets us avoid copying and pasting code.
We peeked at one widget when we did control structure, but now we take a tour of he toolkit. Our output will no longer be a black-and-white still. It can become a color movie.
Exceptions let us transmit bad news from one part of the program to another when something has gone wrong. Events are stimuli arriving from outside of the program: keystrokes, mouse clicks, etc. (It is also possible for one part of the program to create an event to stimulate another part.) Lets hope our program can handle the events as they occur, and not get snowed under.
A multi-threaded program can do more than one task at the same time. A server may have to deal with multiple clients simultaneously; even the humble client may wish to do input and output simultaneously. But we wont have time for networking applications. Our example will be a video game that has to move objects on the screen while listening for keystrokes and mouse moves.