Object-Oriented Programming


Monday and Wednesday 3:30 - 4:50 pm
Room 109, Warren Weaver Hall

Professor Edmond Schonberg

Instructor: Edmond Schonberg (schonber@cs.nyu.edu)

Office hours : WWH410, Monday and Wednesday 5-7 pm, and by appointment.

Teaching Assistant: Joseph Turian ( turian)

Office hours : WWH427, Wednesday 5-7 pm, Thursday 4:30-6:30 pm.

Grader: Michael Schidlowsky ( mikes)

Class list

All students should register themselves with the class list, which is used for all technical discussions concerning the course and the course project. To subscribe to this list visit the web page:


where you will find full directions.

Please send all your questions to this list (not only to the instructor) so that everyone can participate.

Goals of the course.

This is a course about software construction, and involves both design and programming techniques for building large software systems. Object-Oriented design is a widely-used approach to building large software systems, and object-oriented programming languages are the most popular languages in use today. We will begin by reviewing the most interesting aspects of Java, a language which which you are all familiar with. We will introduce the basics of Object-Oriented design, and relate them to Java constructs and programming techniques.

We will then examine UML, a popular design methodology that gives us useful tools for thinking about program architectures in the large. We will also discuss Patterns, a catalogue of common architectures that a competent software engineer must be familiar with.

We will then study C++, first as a general-purpose programming language, and then as a testbed for object-oriented design techniques. We will discuss templates and generic programming, and we will examine the Standard Template Library (STL) which is an important collection of data-structures and algorithms in C++.

Time permitting, we will discuss generic programming in other languages, and examine the generic facilities in the next Java standard.



Cay Horstmann: Objet-Oriented design and patterns (John Wiley)
Walter Savitch: Absolute C++ (Addison Wesley)

Course Work

There will be a number of programming assignments, a midterm, and a comprehensive final examination. Each one of the three components has equal weight.

To get an A in the course, you must hand in all assignments on time.


Assignment 0 (warmup)
Assignment 1 (more review)
Assignment 2
Assignment 3
Assignment 4
Assignment 5
Assignment 6

Example programs

a Point class
Exception declaration, throwing, and handling
Generating Pascal's triangle
Heapsort for comparable objects, and using comparators
Simple tests of sorting routines
Comparator for string using length
Comparator for string using last character
A simple timer event handler
A more involved event handler: Loyd's Fifteen puzzle
Infinities and NaN's in floating point arithmetic
A simple example of nested class definition and use
a blinking panel, illustrating the use of Sleep
A small animation, illustrating threads

Operator overloading in C++
Reference parameters in C++
Introducing templates
A template function: Heapsort
STL containers: the doubly-linked list
STL containers: the set
STL containers: the map
the forall filter/set constructor

Lecture materials

The elements of class design
The elements of class design: a simple use case
Class design exercise: a kiosk for the subway
Introduction to C++ (powerpoint)
Operator overloading, friends, inheritance etc. (powerpoint)