CSU 370   Fall 2007
Object-Oriented Design



The course presents the theory and practice of object-oriented programming. The course enhances students understanding of the concepts of object, class, message, method, inheritance, and genericity. The course covers a basic model for objects; the principles of types and polymorphism in object-oriented programming languages; different forms of abstraction; and theory and practice of reuse. The course also introduces students to some object-oriented design patterns that practitioners have found useful.



Dec 9: The exam tomorrow appears to be in HT (Hurtig Hall), room 224, from 13h00-15h00. You are allowed one double-sided 8-1/2x11 sheet of paper; no other notes, books, or electronics allowed.

Dec 8: Last lecture is up (the Java mutability model one.) Also added the topics from the final review.

Dec 5: Submission instructions for Exercise 4 of Homework 7 are up on the discussion group, in the "Homework #7" topic.

Dec 4: Last two lectures are up.

Nov 25: Catching up on lecture notes; all but lecture 16 (the model of mutation) are up below.

Nov 20: Homework 7 is out. See below for the problem set and the corresponding code. There is a lot of code, so start looking at this early. More to follow on the discussion group; check often.

Nov 8: Getting the music going requires that all your classes in the music package work correctly. While you should have all corrected your previous homeworks to correct the bugs that the graders found (I'm thinking of the Note class in particular, where some of you decided to make the fields static, something that will lead to extremely interesting behaviors when you try to actually play the notes!), I suspect some of you may have "forgotten" to do so. So let me provide two compiled Note.class and Pitch.class that you can use. See, for instance, this link for info on how to import a class file in your Eclipse project. (You may need to remove the .java files for Note.java and Pitch.java that you already have in there, and move the new class files to the music package.)

Nov 6: The midterm's mean seems to be around 39, so a bit higher than I expected. I will try to post a more careful discussion of the answers by the end of the week. Stay tuned.

Nov 4: Typo in homework 6, in the specification of hasNext for concatenated voices: the AND should be an OR. Thanks to Ian for spotting it. Also: for the optional bit of the homework, here are the files MidiPlayer.java containing the code to interface to the Java Sound API, as well as Samples.java containing some sample music.

Oct 31: Happy Halloween! For class yesterday, I would have covered the Java Collections Framework, which is theoretically completely uninteresting, but nevertheless extremely useful so that you can avoid re-inventing the wheel everytime you program in java. I do not intend to recover the lecture at a later date, so please please go over the assigned reading, because I will assume that you are familiar with the basics of the Collections framework from now on.

Oct 30: No lecture this morning - home sick. But homework 6 is out - see below. Due Nov 9th.

Oct 23: Lecture notes for this morning are up. I've also attached the "cheat sheet" I used to give you back the list of topics to review for the midterm.

Oct 22: I've been getting reports from the TAs that some students' code is running off the right side of the printed page. It is usually a good idea to follow the 80-columns layout for code, that is, have lines of code that do not go for more than 80 characters. 80 columns is the common dimension for editors, terminal emulators, printers and debuggers, for reasons mostly historical. Please see here for tips on how to get Eclipse to give you a line at the 80-column mark. You can also find some more Java style guidelines here.

Oct 22: Couple of typos and clarifications in homework 5 (spec of .equals() and hashCode()). See the discussion group for more details. The copy of the homework below has been corrected.

Oct 17: Lecture notes for last two classes are up. We are now fully caught up. Let's see how long it lasts...

Oct 16: Homework 5 is out, due Sunday October 28, at 22h00.

Oct 14: Lecture notes for lectures 8 and 9 are up. I am slowly catching up...

Oct 12: Readings for this morning's lecture are up.

Oct 8: The class on Tuesday (Oct 9th) is cancelled. See you all Friday.

Oct 5: Homework 4 is out, due Sunday October 14, at 22h00.

Oct 2: Software Testing notes are up.

Oct 2: Readings for next lecture from the textbook, sections 3.1-3.5 (on design - another take on the ADT approach) and section 6.1 (inheritance).

Sep 30: Added a sample tester for a hypothetical integer stack ADT in the notes for the Sep 28 lecture below. Have a look. It is a variant of the ClassroomTester. There are also some hints as to how to test the equals() method.

Sep 29: Update to homework 2 - the first argument to Pitch.named() must be one of the strings shown in the specification. If this is not the case, then a runtime exception should be thrown. Along the same lines, the second argument to Pitch.named() and the second argument to transposed() must be such that the equivalent Pitch.numbered() argument does not violate the constraint on valid inputs to numbered(). If this is violated, then a runtime exception should be thrown.

Sep 29: Typo in homework 2, the specification for equals. I have linked the corrected version below.

Sep 27: Tuesday's lecture notes are up.

Sep 27: Lecture notes for last week are up. I hope to be done with last Tuesday's notes later tonight.

Sep 25: There seems to have been some confusion on the due date for homeworks 2 and 3. I initially meant for the dates on the homeworks to be the correct ones. Part of the confusion is that my initial draft of the syllabus had incorrect dates. Sigh. In any case, I am willing to give some leaway on this homework, because of this confusion. Thus, I will accept homeworks until October 1st, 22h00. (That's Monday evening, if you follow at home.)

Sep 25: Readings for next lecture are down in the schedule.

Sep 22: I should have put these up before, but I have added some links to the official Java documentation in the online resources section below. That's the definite place to go when you have a question about the language.

Sep 21: Homeworks 2 and 3 are out; see below. Due in (two weeks? no... this was a massive typo. After a couple of back and forths, the new deadline is October 1st.) They are handed out together because they go together. Homework 2 asks you to implement a class, and homework 3 asks you to implement a testing class for the class you wrote in homework 2.

Sep 17: Correction to the ClassroomTester.java testing code, including comments :)

Sep 16: Lecture notes for first three lectures added below.

Sep 15: Forgot to add - the ClassroomTester testing code for homework 1 is linked below. This is what we will use to test the code you send us.

Sep 15: First off, readings for next class are posted below; basically, read about packages. Also, I figured out 5 minutes after class why my code did not compile there at the end. Abstract classes cannot have constructors, as they are abstract and cannot be instantiated. Duh. My lecture notes will reflect that, once I get around to posting them (hopefully by the end of the week).

Sep 15: Typo in homework 1: the signature defines a method totalSeats() while the specification defines it as totalCapacity(). They should both be totalCapacity(). The homework below has been updated.

Sep 11: Oh, and readings for next lecture have been posted in the Schedule below.

Sep 11: I've created the Facebook discussion group NU CSU 370 Fall 2007 Pucella; please join. (If you are not registered for the class, or not yet at least, drop me an email as well so I know to approve you.)

Sep 11: Homework 1 is out, due Sep 18 at 22h00. I will discuss submission next week.

Sep 7: Wiley sent me a friendly email stating that our textbook is also available 50% as an online book. I will not be using the textbook in class directly, I will only give out readings, so there is no issue with having an online version. See here, and check out the "STUDENTS" box on the right.


Course Information

Time and Location: Tuesday/Friday 9h50-11h30, in 108 West Village H (#23H)

Instructor: Riccardo Pucella, 328 West Village H (#23H)

Office Hours: Monday/Wednesday 16h00-17h30

Teaching Assistants:

  • Alec Heller, 308 West Village H
    Office Hours: Friday 14h00-15h30
  • Bryan Chadwick, 308 West Village H
    Office Hours: Tuesday 15h00-16h30

Course Web Site: http://www.ccs.neu.edu/home/riccardo/csu370

Prerequisites: CSU 213

Textbooks: The textbook for the course is:

  • Cay Hostermann, Object-Oriented Design and Patterns, 2nd edition, John Wiley and Sons, 2006

Grading: Grading will be based on weekly homeworks (50%), a midterm (25%), and a final exam (25%).

There may also be one or more quizzes, which may count as either assignments or exams at the whim of the instructor.

While some program assignments may require students to work in teams, most assignments and all quizzes and exams are individual. Student work is subject to the Academic Honesty and Integrity Policy.

Security is an important aspect of software development. In this course, students are expected to protect the software they develop from plagiarism. The quality of this protection will be graded.


Schedule Outline and Lecture Notes

This schedule is subject to change without warning. Readings will be assigned to supplement lectures, and posted here.

Sep 7


- Lecture notes

Sep 11

Algebraic specifications

- Lecture notes
- Homework 1 goes out
- Readings for next lecture:
  - Textbook chapters 1 and 2.1
  - Will Clinger's notes on Java

Sep 14

Java review

- Lecture notes
- Readings for next lecture:
  - Reread the bit about packages in Textbook, chapter 1
  - Java online tutorial on packages

Sep 18

The Java type system

- Lecture notes
- Readings for next lecture:
  - Textbook, sections 7.1, 7.2, 7.3

Sep 21

The Java type system (continued)

- Lecture notes
- Homeworks 2 and 3 go out

Sep 25

Intro to software testing

- Lecture notes
- Readings for next lecture:
  - Java Tutorial on exceptions
  - Section 3.7
  - Wikipedia's entry on Unit Testing
  - Wikipedia's entry on Black Box Testing

Sep 28

Software Testing

- Lecture notes
- Sample tester IntStackTester.java

Oct 2

Subclassing and Inheritance

- Lecture notes
- Readings for next lecture
  - Textbook, sections 3.1-3.5
  - Textbook, section 6.1

Oct 5

From Specification to Implementation

- Lecture notes
- Homework 4 goes out

Oct 9

Class canceled


Oct 12

Interfaces and polymorphism

- Lecture notes
- Readings for next lecture:
  - Textbook, sections 4.1-4.2
  - Java tutorial on interfaces and inheritance. Note in particular how they conflate inheritance and subclassing

Oct 16

Two uses for interfaces

- Lecture notes
- Homework 5 goes out

Oct 19

Functional iterators
Generic interfaces

- Lecture notes

Oct 23

Generic classes
Midterm review

- Lecture notes
- Java tutorial for generics
- A more technical tutorial by the person responsible for getting generics into Java
- Midterm review topics

Oct 26



Oct 30

Java Collections framework

- Class cancelled
- Homework 6 goes out
- Readings:
  - Java tutorial on Collections

Nov 2

Revisiting the type system

- Lecture notes

Nov 6

Enforcing static properties

- Lecture notes

Nov 9

A Model of Mutation

- Lecture notes

Nov 13

The Adapter and Visitor design patterns

- Lecture notes

Nov 16

The Transformer design pattern

- Lecture notes

No 20

Overview of Homework 7

- Lecture notes: see first part of Homework 7
- Homework 7 goes out

Nov 23

Thanksgiving - no classes


Nov 27

Observer design pattern and UML

- Lecture notes
- Readings:
  - Textbook, section 2.8-2.10
  - Martin's tutorial on UML Class diagrams

Nov 30


- Lecture notes
- Readings:
  - Java documentation on assertions

Dec 4

Final exam review

- Final review topics



Homeworks have been removed.


Online Resources