CS 3500   Spring 2011
Object-Oriented Design


 

Overview

Official summary (sightly modified): Presents a comparative approach to object-oriented programming and design, with an emphasis on techniques for programming large-scale systems. Discusses the concepts of object, class, meta-class, message, method, inheritance, and genericity. Reviews forms of polymorphism in object-oriented languages. Contrasts the use of inheritance and composition as dual techniques for software reuse: forwarding versus delegation and sub-classing versus sub-typing. Studies main programming language tools and techniques to facilitate the creation of applications: modularity, encapsulation, code reuse techniques, design patterns. Basic concepts in object-oriented design are illustrated by writing programs in one or more object-oriented languages.

 

Announcements   [RSS]

Mon, 25 Apr 2011: Here is the final exam information I have. Let me know if it does not match yours. See you tomorrow morning.

      Final Exam  8:00am - 10:00am   Ryder Hall 433   Apr 26, 2011

Tue, 19 Apr 2011: Homework 5 has been graded. Grades are up on Blackboard, and the actual homework can be recovered from the envelope on the door of my office. They're in alphabetical order. Try not too mess that up too too much please. (I've also tossed in previous unclaimed homeworks as well. If you have more than one homework to pickup, I've stapled them all together.)

Tue, 19 Apr 2011: Here is the review sheet that I read this morning in class summarizing the topics we have covered in class, to help you review for the final. You are responsible for everything done in class or written in the notes for all lectures. The final will be very much like the midterm, with some theory questions and some coding questions. The final is closed books, but you can bring a two-sided 8.5x11in cheat sheet.

Mon, 18 Apr 2011: Because of Patriots' Day (or the marathon, take your pick), no office hours this afternoon. I will hold replacement office hours tomorrow (Tuesday) after class, so 13h30-15h30. Moreover, I will be available the rest of the week by appointment, so if you need to see me, drop me an email, and we'll figure out a meeting time.

Tue, 12 Apr 2011: Lecture notes for this morning's lecture on the model-view-controller design pattern are up, along with sample code.

Sun, 10 Apr 2011: Homework 6 is out. I will accept submissions for this homework until Wednesday, April 27th, the day after the exam. Source code for the homework is in the Homeworks section of the web site, as usual. Look at it, and familiarize yourself with the code. There's a lot in there for you to look at.

As I said in class, for this homework, you may work in pairs. You do not have to, but I strongly recommend it.

Fri, 08 Apr 2011: Lecture notes for this morning's lecture on the publisher-subscriber design pattern are up, along with sample code. And I don't know what I was thinking this morning when I couldn't get substitution to work. Turns out I was using the wrong syntax for writing substitutions. Read the lecture notes, you'll see what I mean. The code works. Try it.

Tue, 05 Apr 2011: Lecture notes for this morning's lecture on adapters and iterators are up, along with sample code.

Mon, 04 Apr 2011: Lecture notes for Tuesday's lecture on mutation and copying and Friday's lecture on variance are up.

Sat, 26 Mar 2011: Lecture notes for Friday's lecture on mutation are up. Sample code is also available from the web page.

Sat, 26 Mar 2011: Homework 5 is out. Due Wednesday, April 6 at 22h00, as usual. Helper files for the homework can be found on the homeworks section of the website. Lecture notes for Friday's lecture should be out sometimes tonight.

Thu, 24 Mar 2011: Lecture notes for Tuesday's lecture on multiple inheritance are up. Sample code is also available from the web page. You may also want to read Chapter 12 from Programming in Scala for more details about traits, including linearization.

Sun, 20 Mar 2011: Okay, this took a while, but here are the lecture notes for Friday's lecture on inheritance from delegation are up, and code is available from the website.

Tue, 15 Mar 2011: Lecture notes for this morning's lecture on inheritance and delegation are up, and code is available from the website.

Sun, 13 Mar 2011: Homework 4 is out. Due Wednesday, March 23, at 22h00 as usual. Helper files for the homework can be found on the homeworks section of the website.

Sat, 12 Mar 2011: I finished grading the midterm last night, and the grades are up on Blackboard. Average of 38.32 (maybe one mark lower than I expected), and standard dev of 5.92 (much better than expected). Overall, no big surprises. We'll talk about it on Tuesday. Homework 4 coming up by the end of day today.

Thu, 10 Mar 2011: Lecture notes for Tuesday's lecture on streams are up.

Wed, 09 Mar 2011: Oops. I forgot to setup the submission system for homework 3 this week. It's better now. (I didn't expect people to try submitting after I gave the extension, and then it completely flew out of my head.) As I said in class, I'm happy to accept submissions for homework 3 until Friday night (as usual, 22h00).

Tue, 08 Mar 2011: Here is an updated version of the sheet I read this morning in class summarizing the topics we have covered in class, to help you review for the midterm. You are responsible for everything done in class or written in the notes for all lectures up to and include this morning's. Remember that the midterm will be about half theory questions, and half coding questions. The exam is closed books, but you can bring a one-sided 8.5x11in cheat sheet.

Mon, 28 Feb 2011: I will be around for Spring Break (but our TA Jake will not be). If you want to meet, please drop me a quick email and we can sync up. Otherwise, see you all next week.

Sat, 26 Feb 2011: My reference implementations for OString, Room, and Atlas have been posted as helper files for homework 3 on the Homeworks section of the course web site.

Fri, 25 Feb 2011: Lecture notes for this morning's lecture on parameterized classes are up.

Tue, 22 Feb 2011: Lecture notes for last Friday on implementing subtyping in Scala and for this morning on multiple subtyping are up. Code is available from the web page.

Sun, 20 Feb 2011: Homework 3 is out. Due Tuesday, March 8. You can use the old AtlasTester for Question 3.

Tue, 15 Feb 2011: Lecture notes on subtyping and static information loss are up.

Mon, 14 Feb 2011: Testers for homework 2 are available. See the Homeworks section of the web site. Oh, and Happy Valentine's Day!

Sat, 12 Feb 2011: Lecture notes on static and dynamic types and on understanding subtyping are up. I've also uploaded the code from the lecture on hiding.

Thu, 10 Feb 2011: Lecture notes on hiding (last Friday and first half of this Tuesday) are up.

Sun, 06 Feb 2011: Homework 2 is out. Due Feb 16. Testers coming early next week.

Tue, 01 Feb 2011: Lecture notes for this morning's lecture on subtyping are up, as is the code.

Mon, 31 Jan 2011: The tester for ADT Direction is now available. It tests the equations in the specification against your implementation of the ADT. To use: (1) Download the file and put it in the same directory/folder as your implementation. (2) Compile it along with your implementation (e.g., scalac Direction.scala DirectionTester.scala, or scalac *.scala if that's the only source files you have in the directory). (3) Execute the tester: scala DirectionTester -- because if you look at the tester, it has a main() function that makes it an executable module.

Here is a sample output on my system (a Mac OS X machine):

     [hw1] l
     Direction.scala    DirectionTester.scala
     [hw1] scalac *.scala
     [hw1] l
     Direction$.class   Direction.scala          DirectionTester.class
     Direction.class    DirectionTester$.class   DirectionTester.scala
     [hw1] scala DirectionTester
     All tests succeeded
     [hw1] 

Mon, 31 Jan 2011: The tester for the Direction ADT will be coming out sometimes tonight. Still hacking out some of the kinks.

Sun, 30 Jan 2011: Couple of things you should know. First, the submission system is still getting some kinks worked out of it, but I expect to have it up by tomorrow morning. Second, I've updated the TA information on the web page (Jake Rozin, in case you missed Friday's lecture) complete with office hours and email address. Third... there was a third thing. Hold on. Oh yes, about homework 1, question 1. I was a bit ambiguous about the intended interpretation for the isPrefix() operation. It should really read:

      L.isPrefix(M) should return true if M is a prefix of L
      (that is, a list equal to L can be obtained by adding zero or
      more elements at the end of M) and false otherwise.

Thus, in particular, a list is a prefix of itself.

Fri, 28 Jan 2011: Lecture notes from this morning's on errors are up.

Thu, 27 Jan 2011: Lecture notes from last Tuesday on Scala specifics is up.

Thu, 27 Jan 2011: Here are some installation instructions for scala for Windows, Linux, and Mac OS X. Let me know if something's wonky.

Wed, 26 Jan 2011: Homework 1 is out. Because it's out a day later than predicted, it will be due a day later than predicted, so Wednesday, Feb 2.

Wed, 26 Jan 2011: Lecture notes for the second week have been posted on the course web page.

Sat, 22 Jan 2011: I will hold office hours this semester on Mondays, 15:00-17:00. The door's open, feel free to drop by. If you cannot make that time, please send me an email, and we can arrange an individual meeting.

Sun, 16 Jan 2011: Lecture notes for the first week have been posted on the course web page, the Introduction and the lecture on ADTs and specifications.

Mon, 10 Jan 2011: I'm setting up the RSS feed for the course. You should see an RSS link up in your browser. Using a feed reader is probably the best way to keep up to date with the course. Oh, and welcome, by the way.

 

Course Information

Time and Location: Tue/Fri 11:45-13:30 108 West Village H (#23H)

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

Office hours: Mondays 15:00-17:00 (in 328 WVH)

Teaching Assistant: Jake Rozin (Office hours: Thursdays 14h00-16h00 in 102 WVH), email: rozinj@ccs.neu.edu

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

Prerequisites: CS 2510

Textbooks: The only textbook for this class is really a reference manual for the language we will be using, Scala:

There are also online references for Scala, towards the bottom of this web page. As far as a textbook for the design part of the course, there is none. I will post lecture notes here, and give you pointers to online documents. You may find the following book useful, although it is not required, and we won't actually follow it:

  • C. 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.

Jan 11

Introduction

- Lecture notes

Jan 14

Abstract data types

- Lecture notes

Jan 18

ADT implementations

- Lecture notes
- Code

Jan 21

Object-oriented ADT implementations

- Lecture notes
- Code

Jan 25

Scala Specifics

- Lecture notes

Jan 28

Errors

- Lecture notes
- PointTester.scala

Feb 1

Code Reuse: Subtyping

- Lecture notes
- Code

Feb 4

Hiding implementation details

- Lecture notes
- Code

Feb 8

Static and dynamic types

- Lecture notes

Feb 11

Understanding subtyping

- Lecture notes

Feb 15

Subtyping and Static Information Loss

- Lecture notes

Feb 18

Implementing subtypes

- Lecture notes
- Code

Feb 22

Subtyping multiple types

- Lecture notes
- Code

Feb 25

Parameterized classes

- Lecture notes

Mar 8

Design Pattern: Streams

- Lecture notes
- Code

Mar 11

Midterm

 

Mar 15

Inheritance and delegation

- Lecture notes
- Code

Mar 18

From delegation to inheritance

- Lecture notes
- Code

Mar 22

Multiple Inheritance and Traits

- Lecture notes
- Code
- Readings: Chapter 12

Mar 25

Mutation

- Lecture notes
- Code

Mar 29

Mutation and Copying

- Lecture notes
- Code

Apr 1

Subtyping and Parameterized Types

- Lecture notes
- Code

Apr 5

Design Pattern: Adapters

- Lecture notes
- Code

Apr 8

Architectural Pattern: Publisher-Subscriber

- Lecture notes
- Code

Apr 12

Architectural Pattern: Model-View-Controller

- Lecture notes
- Code

 

Homeworks

 

The Homework Submission Web Interface.

 

Scala Resources

As I said above, my goal is to use Scala as a programming language in this course. You can think of Java as the next iteration of Java, although it is not a Sun language, but rather was developed at EPFL in Switzerland. More details on the Scala programming language web site:

The latest stable release is version 2.8.0. This is the version we will be using. You can download the Scala compiler here:

If you want to use Scala from the Eclipse IDE, then I suggest you install the Scala plugin for Eclipse (which install Scala too, so no need to install it separately). The Eclipse Scala plug-in can be found here:

Note that this seems to require Eclipse 3.5.2 [codenamed Galileo]. The plug-in for version 3.6 of Eclipse [Helios] seems to be still experimental, so use at your own risks. I suggest installing a version of Eclipse 3.5.2 if you want to use the Scala plug-in. That version of Eclipse can be found here:

You install the plug-in from within Eclipse itself -- here at the instructions:

If you have any trouble, please send us an email.

If you use a different IDE, you can find some plug-ins for other IDEs like IntelliJ here:

There is a version installed on the Linux server on the college network, but that version is 2.7.5, which is unfortunate, because there has been some changes to the standard libraries between the two versions. I will ask them to update the install, but it might take some time. In the meantime I will make my version available to you there, if you want. Just let me know

There is a fair amount of online documentation on Scala. Here are some good starting points: