Computer Science 390 Special Topics: Programming in Java First Summer Session, 1997

Dr. Stephen Bloch office 112 Alumnæ Hall phone 877-4483

                email sbloch@boethius.adelphi.edu

office hours ???

May 27, 1997

1 Subject Matter

This will actually be two different courses, taught by the same professor in the same room at the same time. One is an introductory programming course, using Java as the example programming language; the other is for experienced programmers who want to add Java to their repertoire of programming languages. I haven’t done this before, so I’m not sure how it’ll work....

Java is a fairly new language. Invented in 1991, it was a commercial flop until the World Wide Web developed in 1994, and Java’s inventors realized that their language’s strengths made it ideal for making Web pages interactive. Since this was demonstrated in 1995, Java has become immensely popular as an adjunct to Web page design. But Java is in fact a general-purpose programming language, like Pascal, C, or C++, and its designers have learned from the problems of those three languages (so they could give us a new and different collection of problems).

Java is an object-oriented language, like C++ but more so. Object-oriented programming has been one of the catchphrases of the software industry for 5–10 years, and it is widely accepted now as a good way to organize large, complex software projects. I intend to introduce you to object-oriented (“OO”) thinking at the same time as we learn the Java language. In brief, most non-OO programs are designed and written by listing what actions need to be performed in what order, then breaking down each of these actions into a sequence of simpler actions, etc.; an OO design, by contrast, is broken down primarily by what kinds of objects the program deals with, and what services each of them can perform at the request of the others. To use an analogy from English grammar, we’ve shifted the emphasis from verbs to nouns. These “kinds of objects” (or “classes”, in the terminology of Java and most other OO languages) have considerable structure of their own: some are specialized versions of others (e.g. a truck and a sedan are both kinds of automobiles), some contain others (e.g. all automobiles have wheels as a component), etc. Indeed, in Java every program you write is itself an object of a particular class, often a specialized version of a predefined class like

Applet or Frame.

Java is based, in many ways, on C++, which is in turn based on C. Much of Java’s syntax will be familiar to C and C++ programmers. But C and C++ are both notorious for how easily programmers can produce horrible, hard-to-find bugs; Java’s designers analyzed the most common bugs in C and C++ and simply made them impossible in Java, without significantly reducing the expressive power of the language.

2 Reading and Software

If you consider yourself a beginning programmer, please buy the textbook Java: How to Program, by Deitel & Deitel, pub. Prentice Hall 1997. This book was written explicitly for a first-year programming course. I hope to get through chaps. 1–8, 17, and ideally 9 and 10, by the end of the semester. This is 450–550 pages, or about 15–18 pages per day, including weekends.

On the other hand, if you consider yourself a reasonably experienced programmer, I recommend the textbook Core Java, by Cornell & Horstmann, part of the Sunsoft Press Java Series; the second edition came out in April, 1997. I hope to get through chaps. 1–10, and ideally 11–13, by the end of the semester. This is 450–600 pages, or about 15–20 pages per day, including weekends.

In either case, I’m asking you to do a lot of reading. Please keep up with the reading. Don’t just come to class and take notes, because the authors of these textbooks know more about Java than I do. I want to spend my time in class explaining what’s in the texts, adding my own perspectives, filling in things omitted from the texts, and helping people with their programs; I do not want to spend my time reading the texts to you.

   I maintain a Web page for the class at http://www.adelphi.edu/~sbloch/class/390/.

The Web page will contain a copy of this syllabus, a (hopefully up-to-date) schedule of what programming and reading assignments are due when, and links to other relevant pages such as my “Adages on Software Design and Development”, which I recommend that you all read in bits and pieces as time allows.

This semester we’ll do most of our programming on the HP Vectra computers in room B33. Computing Center staff have recently upgraded these machines to Windows/NT and installed Netscape, Internet Explorer, and Symantec’s Café, which is an integrated Java compiler, interpreter, editor, debugger, class browser, and I don’t know what else. It looks quite powerful and friendly to me, although the “tutorial” on the help menu seems to have been written for an earlier version of Café.

3 Homework

In my experience (having programmed in over a dozen different computer languages, and learned a smattering of a dozen more), the only way to learn a computer language is to write programs in it. Lots of programs. The first few may be trivial examples — indeed, they may be copied verbatim out of a textbook — but you need hands-on experience making programs work before you can consider yourself a competent programmer in a particular language.

So I expect you to design, write, debug, and test a lot of programs. A few of these programs (probably one a week) will be specifically assigned, to be turned in. But for the rest, you’re on your own. When I describe a new language feature or a new programming technique in class, your first thoughts should be “how can I try this? how can I use this to do something nifty?”

Programs are not abstract works of art, they are supposed to run and solve real problems. So if I get a program that doesn’t compile, or a program that has little or nothing to do with the problem I assigned, I will give it a zero, no matter how much time you put into it. Don’t turn in a program you haven’t tested yourself: if you can’t be bothered to test it, I can’t be bothered to grade it.

4 Grading

As I write this (a week before classes start), I envision four homework assignments, each worth 20% of the semester grade, and a final exam worth 20%. I may change this somewhat as the semester unfolds.

Exams must be taken at the scheduled time, unless arranged in advance or prevented by a documented medical or family emergency. If you have three or more exams scheduled on the same date, or a religious holiday that conflicts with an exam or assignment due date, please notify me in writing within the first two weeks of the semester in order to receive due consideration. Exams not taken without one of the above excuses will be recorded with a grade of 0.

Homework assignments will be accepted late, with a penalty of 1/3 per 24 hours or portion thereof after they’re due. An hour late is 33% off, 25 hours late is 67% off, and after 48 hours don’t bother turning it in. It’s still a good idea to do as much of it as you can, however, because I’ll assume on the exams that you’ve done the homework.

5 Ethics

Most of the assignments in this class are to be done individually. You may discuss general approaches to a problem with classmates, but you may not copy large pieces of homework solutions. (Code provided for you by the Café Java development environment is OK.) If you do, all the students involved will be penalized. If I choose to allow a particular assignment to be done in groups, I’ll tell you so clearly.

All work on an exam 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, both students will be penalized; see above.

6 Schedule

This class meets every Monday, Tuesday, Wednesday, and Thursday from 10:40 AM to 12:40 PM, except on University holidays or if I cancel class.

At certain points in the semester, I’ve split the “lecture subject” in two: the subject before the slash is for the relative beginners, while the subject after the slash is for the more experienced programmers. I’ll probably work with one group while the other group work alone or discuss among themselves, then switch off as necessary.

I expect you to have read the specified pages in the textbook 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 the textbook!

Date(s) D&D Reading C&H Reading Lecture Subject 27 May Intro, history, administrivia, using Café 28 May skim Preface skim Preface,ch.2 Using Café; sample programs

read 1–55 read 1–17

29 May 60–86  48–91  Basic types and control structures
30 May  no class  Last day to add courses or go pass/fail
2 June 272–297  93–114  Classes, Objects, and Methods
3 June 438–483  181–219  Graphics in Java
4 June 86–103  221–257  control structures / AWT
5 June 110–149  257–316  Repetition / AWT
6 June  no class  Last day to drop courses
9 June 154–176  319–342  Methods / Applets
10 June 176–205  342–363  Recursion / Applets
11 June 297–320  114–139  Class-related features of Java
12 June 324–347  141–157  Relationships among Classes
13 June  no class  Last day to withdraw from courses
16 June 347–373  158–179  Polymorphism
17 June 214–231  423–439  Arrays / Exceptions

18 June 231–252 414–421,440–455 Arrays / Exceptions 19 June 376–403 505–527 Strings / Multithreading 23 June 403–431 471–482,528–553 Stringlike Classes / Multithreading 24 June 860–890 365–414 Self-referential Data Structures 25 June Catch up, summary, review for final 26 June Final exam