Lectures and notes for CS497REJ:  Object-oriented Programming and Design

Lectures are videotaped at two speeds.  "56K" is for people with a high-speed 56K modem, while "100K" is for people with an even faster ISDN line or something similar.

The dates on the schedule indicate where you should be.  It is excellent to be ahead of schedule, and it is not good to fall behind.

I have included questions below for each lecture.  If you are in a group, discuss these questions.  If you are by yourself, think about them, because some of them will be on the final exam.

We found that demonstrations on a computer did not videotape well, so we are in the process of making special AVI files for each demonstration.

If you see any links that might be wrong, please let me know.

Course Introduction

    Aug  25 -  Lecture 1, part1:  56K, 100K.  Notes in  postscript , PDF , Powerpoint
                  Lecture 1, part2:  56K, 100K
                 demo
 

Basics of Smalltalk and OOP

People say that "In Smalltalk, everything is an object."  Moreover, computation is just sending a message to an object.  This isn't quite true, but it is almost true.  What is the benefit of such uniformity?  In other words, what advantages do we get from making everything an object and turning every computation into a message?  In Smalltalk, what is NOT an object?  What kind of computation is not a message?  Explain what happens when you send a message to an object.

    Aug 27 - Smalltalk in a Nutshell.  Notes in  postscript , PDF , Powerpoint
                Lecture 2, part1: 56K, 100K
                demo

    Sep 1 - Payroll example
                Lecture 3, part1: 56K, 100K

               Control structures, abstract classes.  Notes in  postscript , PDF , Powerpoint
                Lecture 3, part2: 56K, 100K
The Smalltalk syntax does not have if statements or loops.  Instead, it has blocks and messages.  How can you build an if statement or a loop from blocks and messages?  What is the advantage of having blocks and messages in your language?  How important are blocks to object-oriented programming?

What is an abstract class, and why is it important?
 

    Sep 3 - Lecture 4, part1: 56K, 100K

What is polymorphism, and how is it related to the idea that all computation is messages?

What are some of the disadvantages of making numbers objects and making arithmetic be messages?  What are some of the advantages?

               Polymorphism, double-dispatching, and Smalltalk numbers.  Notes in  postscript , PDF , Powerpoint
                Lecture 4, part2: 56K, 100K

Some languages have arrays and strings built in, but Smalltalk does not.  What is an advantage to leaving them to the class library?  What is a disadvantage?

Collection is an abstract class.  What are some of the Template Methods in Collection?  (See the Design Pattern book if you are not clear on Template Methods.)  What are the methods that you have to implement when you make a subclass of Collection?  How could you find out if you don't have anybody to ask and the manual doesn't tell you?

   Sep 8 - Collections.  Notes in  postscript, PDF, Powerpoint
                Lecture 5, part 1: 56K, 100K
                Lecture 5, part 2: 56K, 100K

What are the key classes in the testing framework?  How do you use it?  How does the testing framework use inheritance and polymorphism?  Does it have any abstract classes?

    Sep 10 - Lecture 6, part 1 56K, 100K
               Testing.  See the testing framework that you should use from now on.
                Lecture 6, part 2: 56K, 100K  - Just watch the first 7 minutes or so of the lecture, then watch the demo.
                demo part1 (19 minutes, 25 meg), part2 (9 minutes, 12 meg)

How is equality different from identity?  Why is equality user defined?

The rule "when you redefine = then you must redefine hash" shows that the design of one class can have an effect on the design of another.  Explain.

When is a copy of an object equal to the original?

   Sep 15 - Object Identity.  Notes in  postscript , PDF, Powerpoint
                Lecture 7, part 1: 56K, 100K

How can you compose streams to make new streams?  How can you parameterize a stream to make a new stream?  How can you make a subclass of a stream to make a new stream?  Which is better?

               Streams, a simple example of object composition.
                Lecture 7, part 2: 56K, 100K

What is a coding pattern that you have used in some other language (C, Fortran, Pascal, etc.)?  Why are coding patterns important?  If you know C++ or Java, compare and contrast "constructors" in those languages with the Creational Methods in Smalltalk.

    Sep 17- Smalltalk Coding Patterns.  Notes in  postscript , PDF, Powerpoint
                Lecture 8, part 1: 56K, 100K
                Lecture 8, part 2: 56K, 100K
               Demo of change manager.  This is more or less the same as the last six minutes of part 2, but is easier to see.

Design

The word "method" in "Design methods" means something different from the word "method" in Smalltalk.  How are they different?  How are they the same?

Describe at least three ways that design methods can differ from each other.

    Notes in  postscript , PDF , Powerpoint
    Sep 22 - Design methods (OMT and RDD using CRC cards)
                Lecture 9, part 1: 56K, 100K
                Lecture 9, part 2: 56K, 100K
    Sep 27 - Example of designing using CRC cards.  Based on the  stock exchange problem.
                Lecture 10, part 1: 56K, 100K

You should be reading Design Patterns by now. Read Composite, Strategy, Template Method, and Observer first.

What is a pattern?  How are design patterns different from coding patterns?  How are they similar?

               Design patterns
                Lecture 10, part 2: 56K, 100K

The dependence mechanism in Smalltalk is a special case of the Observer pattern described in Design Patterns.  What aspects of it are special?

    Sep 29- The Observer pattern Notes in postscript , PDF , Powerpoint
                Lecture 11, part 1: 56K, 100K
                Lecture 11, part 2: 56K, 100K
 

GUI Framework

Read the design patterns Decorator, Adapter, and Mediator.

    Oct 1 -  Model/View/Controller Notes in postscript , PDF , Powerpoint
                Lecture 12, part 1: 56K, 100K
                Lecture 12, part 2: 56K, 100K
    Oct 6- Lecture 13, part 1: 56K, 100K
                Lecture 13, part 2: 56K, 100K
   Oct 8- Lecture 14, part 1: 56K, 100K Notes in postscript , PDF , Powerpoint
                Lecture 14, part 2: 56K, 100K

Read the papers Patterns Generate Architectures, which is about the design patterns that go into HotDraw, and Documenting Frameworks with Patterns, which is about the patterns that a user of HotDraw must follow. The first is the patterns inside HotDraw, the other is the patterns in its applications. Both kind of patterns are important to a framework.

Read the design pattern State.

You have now seen three frameworks; the testing framework, Model/View/Controller, and HotDraw.  What characteristics do they have in common?  How are they different from each other?  How do they differ from the Collection classes?  What makes frameworks harder to learn than the classes we looked at first?

   Oct 13 - HotDraw     Notes in postscript , PDF , Powerpoint
                Lecture 15, part 1: 56K, 100K
                   Just watch the first 10 minutes.  The rest is a demo.
                Lecture 15, part 2: 56K, 100K
                    The first 32 minutes is a demo.  Then watch the lecture.
 

Design in Context

Read the Visitor, Interpreter, and Iterator patterns.
    Oct 15 - Design - Distributed vs. Centralized Notes in postscript , PDF , Powerpoint
                Lecture 16, part 1: 56K, 100K
                Lecture 16, part 2: 56K, 100K
So, which is better, Interpreter or Visitor?
If you know C++ or Java, how are Iterators in those languages different from in Smalltalk?

    Oct 20 - How to develop software Notes in postscript , PDF , Powerpoint
                Lecture 20, part 2: 56K, 100K (only 16 minutes long)
                Lecture 21, part 1: 56K, 100K
 

Read the five creational design patterns.   What kind of refactoring would you use to convert a program
that didn't use any of these patterns to one that used Factory Method?  How about a program that used
Factory Method to one that used Abstract Factory?

    Oct 22 - Refactoring   Notes in postscript , PDF , Powerpoint
                Lecture 25, part 2: 56K, 100K
                Part 1 was a demo.  Instead, look at the new demo, part1 (36 MB), part2 (10 MB), and part3 (29 MB).
                They are big, and together take over an hour to watch.  It took me a LONG time to make that demo.
                If you have any questions or suggestions for improvement, please let me know.

    Oct 27 - Performance Tuning    Notes in  postscript , PDF , Powerpoint
                Lecture 25 part 1:  56K, 100K
                It is about an hour and 15 minutes.
                See Patterns for Efficient Smalltalk Programming
 

Frameworks

Read the Command and Facade pattern.  Also, look at the papers about HotDraw again.  This time, think about the way the papers are written, not about HotDraw.

What are the advantages to describing a system as a sequence of design decisions?
When you refactor a program, you do it as a sequence of changes.  How is that similar
to the description of HotDraw?  How is it different?

    Oct 29 - Describing frameworks with patterns   Notes in postscript , PDF , Powerpoint
                Lecture 17, part 1: 56K, 100K
                Lecture 17, part 2: 56K, 100K

I argue that it is a bad idea to try to design frameworks up-front, that you should design a framework
at the same time as you build some applications.  Suppose you were asked to build a framework for
something you had never built before?  What should you say?

Read the paper on evolving frameworks.
    November 1-5 is OOPSLA.
    Nov 10 - How to design frameworks   Notes in postscript , PDF , Powerpoint
               Lecture 18, part 1: 56K, 100K
               Lecture 18, part 2: 56K, 100K
    Nov 12 - How to design frameworks
               Lecture 19, part 1: 56K, 100K
            Accounts: a framework for accounting   Notes in postscript , PDF , Powerpoint
               Lecture 19, part 2: 56K, 100K
    Nov 17 -
               Lecture 20, part 1: 56K, 100K
            Analysis patterns  Notes in postscript , PDF , Powerpoint
                Lecture 21, part 2: 56K, 100K
 

Miscellaneous

Read the Proxy pattern.  How does reflection make Proxy easier to implement in Smalltalk than it is in C++?

    November 19 - Reflection I     Notes in postscript , PDF , Powerpoint
                Lecture 22, part 1: 56K, 100K
                Lecture 22, part 2: 56K, 100K

    November 24- Reflection II     Notes in postscript , PDF , Powerpoint
                Lecture 23, part 1: 56K, 100K
                Lecture 23, part 2: 56K, 100K

    November 30 -Implementing Smalltalk (and Java)  Notes in postscript , PDF , Powerpoint
                Lecture 24, part 1: 56K, 100K
                Lecture 24, part 2: 56K, 100K
 

Final exam, December 13.