Lab Assignment #7

Debugging and documenting a C++ program

Description

Download the given cache simulator code, debug it, draw an OOD diagram, draw and give the scenario for a cache write (what sequence of steps is taken and by which object on a this type of call). Both of these should be using Coad/Nicola terminology and notation.

There are a total of six errors in the given code. They deal with protection, class variables, and syntax. You don't have to worry about the correctness of the program as long as it compiles. The code can be debugged by looking at the errors generated by the C++ compiler. These will contain line numbers and some short description for most errors. Notice that a single error may confuse the compiler into seeing a million ghost errors later on which are not really there, so start with the first error!

The OOD diagram should show classes, whole-part relationships, associations (some whole-part rel. may actually be just weak associations). The program contains no gen-spec relationships. The scenario should be given in statements of the form "I am an object of class C; when I receive message X, I do ___ ." Both of these can be handed in on a piece of paper with your name on it.

Compiling C++ code

The C++ program development process is very different from Smalltalk. There are three visible stages, editing, compilation, and linking to libraries (static/private or dynamic/shared). Some commercial compilers offer an integrated development environment where you can do all of these within the same application (which is close to the look an feel of the Smalltalk environment).

Instead of using an integrated environment, for this assignment you will follow the modular philosophy of UNIX and do each step independently with a different tool.

g++ and gcc are free, publicly available compilers for many architecture platforms. Other compilers on the system (the one that came from the hardware manufacturer, for example) can typically be invoked with "cc", "CC", "c++", etc.

Hand-in

Turn in the OOD drawing and scenario to your TA on a piece of paper. Turn in the modified code electronically with the command below. The scenario can be handed in electronically as well.
    cat file.cc | mail -s "LAB 7 - NAME" cs2390@prism.gatech.edu