COM1204, Summer 1998, Prof. Futrelle

Information/Guide for the Midterm Exam

to be held Thursday, August 20th

The exam will focus on the relation between the code we are working with for the phone system and the object-oriented design principles discussed in Meyer's book. The exam will also test your understanding of the C++ constructs and organization used in the code.

C++ code

To get the "easiest" part out of the way first, you should study all of the code in the PS2 system that is on-line and make sure you understand the syntax in detail. It is often not too hard to copy and adapt some code, as you did in your PA2, but I want to be sure you actually understand the operation of the C++ code. Therefore, as you work through the code, if there is any part of it that you do not completely understand, be sure you study the relevant sections of the Lippman and Lajoie C++ Primer so you do understand it.

Here's an example: Should the following appear in a header file or a .cp file:

The answer is that this is the initialization of a static member variable ("slot") which must appear only once. Therefore it cannot be in a header file that might be included in numerous .cp files and lead to errors at link time. It must be in a .cp file. (In the PS2 project it is in the link.cp file.)

Another example might involve some code that shows a collection of slots in various classes, each of which contain an instance of one of the other classes, e.g.,

This can be very difficult to arrange because each such slot needs to be preceded by a full definition of the other class, in this case A. This cross-referencing problem is immediately solved by using slots that are pointers to class instances, e.g.,

This works if there are merely forward declarations available, in this case,

Other topics you should master include member initialization lists, how constructors are called in practice, Boolean operators, chains of references, e.g.,

or notations such as,

One thing to know well is the design and implementation of the Timer class.

Object-Oriented Design

I have explained in class that you should read Chapters 1 through 10 of Meyer using a "top-down" strategy. Your general approach (there will be exceptions) is to do the following:

For each chapter:

Then make another pass through the ten chapters doing this:

Then make a third pass:

For your final pass:

Questions that will appear on the Midterm:

The questions about the material I will ask will involve matching principles I give you and code I give you and writing a brief and concise short paragraph or two about the relation between our design and code and the principles of design laid out in Meyer's book.

Overview of chapters 1 through 10 in Meyer

The list below gives you some guidance as to what to look for in each chapter and especially, how much emphasis to place on each chapter, or what points in each you should pay particular attention to. Pay attention to the fact that Meyer's terminology is not always identical to what is used in C++, e.g., "feature" describes both member variables (slots) and member functions (methods).

Chapter 1 -- Software quality
Introduces important basic terms and ideas.
Chapter 2 -- Criteria of object orientation
What makes software "object-oriented", as opposed to not.
Chapter 3 -- Modularity
Contains five criteria, five rules, and five principles.
Chapter 4 -- Approaches to resuability
Not a critical component of what we have done so far, but be sure that you realize that our code reuses material contained in system libraries of all kinds. Important in the future for any large or complex system or whenever you reuse or adapt or extend material from libraries.
Chapter 5 -- Towards object technology
How we can proceed through the process of choosing what the modules are. The idea that, "Real systems have no top." Read his discussions of this last point carefully.
Chapter 6 -- Abstract data types
How to describe objects as abstract data types. This contains more formalism than we normally study in this course, so parts of it can be read lightly, without trying to learn all the ins and outs of the approach.
Chapter 7 -- The static structure: classes
An important chapter. The distinction between classes and objects must be clear in your mind.
Chapter 8 -- The run-time structure: objects
Another quite important chapter. His discussion of references is about pointers. His expanded types are objects included in others, rather than merely referenced -- this latter design is something we rarely use, except for the built-in string class.
Chapter 9 -- Memory management
Not a major topic for us. Look it over, not deeply.
Chapter 10 -- Genericity
An important topic when designing or using templated classes in C++. But we have done almost none of this, up to this point, so just look it over, not deeply.