Fall 1996 Course Materials for CS-200

Syllabus and Assignments

This syllabus lists the topics I expect to cover each week. As the semester progresses, I will revise it to reflect what actually was done.

Each section of the course meets once a week. Where dates appear in parentheses, the first date is for the Tuesday section (ttc3a) and the second is for the Friday section (ffc3a).

Week 1 (9/3; 8/30)

Course Introduction. Why C++ is important in current software development. Translating a C++ program into an executable file: The preprocessor [cpp], the compiler [c1, c2, etc.], the assembler [as], the linker [ld]. Using the compiler driver [g++] and the make utility [gmake] to automate the process.

Assignment Due Next Class: Read Chapter 1 and do the Self-Review Exercises at the end of the chapter. Check your own work. Write the answers to Exercises 1.13, 1.22, 1.24, 1.25, and 1.26 on paper and hand them in.

There is a document with some After-the-fact Notes on Homework 1 that you should look at.

Week 2 (9/10; 9/6)

C++ Data Types: unsigned/signed, char/short/int/long, float/double, bool, struct/union/class/enum.

Assignment due Next Class: Read Chapter 2 and do the Self-Review Exercises at the end of the chapter. Check your own work. Write the answers to Exercises 2.14, 2.34, 2.36, 2.39, and 2.40 on paper and hand them in.

Week 3 (9/17; 9/20)

Using your Unix account. Logging in and giving yourself a good password. Listing files and directories. Using wildcards. Creating and changing directories. Deleting files and directories. Valid filenames. Filenames that start with a period. Copying files. Editing files. The g++ command line. Using tar. Using pine. Submitting an assignment.

Assignment Due Next Class: Read Chapter 3, and start working on the Self-Review Exercises at the end of the chapter. Check your own work. Do Exercise 3.45 and submit it as described in the Project Management web page. Your solution must use two files, one called gcd.cc that implements the recursive algotithm described in the exercise, and another named main.cc, which is given in class.

Note: Consult the Using Unix web pages for more information about using your Unix account.

Week 4 (9/24; 9/27)

Project management. Using gmake. Using header files. Function definitions, function references, and function prototypes. Function signatures; defining multiple functions with the same name. Using tar. Array declarations and references.

Assignment Due Next Class: Finish doing the Self-Review Exercises at the end of chapter 3. We will discuss some of the topics from the end of the chapter in next week's class (templates, default arguments, scope resolution operator).

The programming assignment for next class is described in the Homework 4 document.

Week 5 (10/1; 10/4)

Function templates, name mangling, default arguments. Array initialization. Defining enums. Introduction to pointers. Development of Homework 5a.

Assignment Due Next Class: Read Chapters 4 and 5 and do the Self-Review exercises at the end of both chapters if you have not done them all already.

Do the programming assignment that is described in the Homework_5a web page. Students in both sections may submit this assignment by midnight October 15 without losing late points.

Week 6 (10/8; 10/11)

Discussion of topics related to Homework 5. Array pointers; converting a types name to a types value by table lookup; const parameters.

Assignment Due Next Class: There will be a one hour exam covering material from chapters 1-5 of the text, as well as material covered in the Using Unix web pages.

Note: The exam will be given during the last hour of the class. Start working on the assignment that is described in the Homework_5b web page. The due date will be the class after the exam (10/29; 10/25).

Week 7 (10/22; 10/18)

There will be a one-hour exam during this class.

Week 8 (10/29; 10/25)

Discussion of topics related to Homework 5b. This assignment is being graded on a ten-point scale instead of 2 points. It will be accepted late, with a penalty of one point (out of ten) per day late. Weekends do not count in computing late points.

Assignment Due Next Class: Read Chapter 6, and complete the Self-Review Exercises at the end of the chapter.

Week 9 (11/5; 11/1)

Introduction to classes and object-oriented design. Review of Homework 5 as an object-oriented design based; Application Programming Interface (API), header files, and libraries. Class Syntax; public and private members. Memory layout of a process: stack, heap, data, and code segments; where objects, functions, and variables reside in memory; how to reference objects using pointers and variables.

Assignment Due Next Class: Finish Chapter 6. Plan how to implemnt the Property List class.

Week 10 (11/12; 11/8)

Review memory allocation for variables and objects. Implementing the Property List class: Changes to the header file, changes to main(), changes to plist.cc. Inline functions and how performance issues impact encapsulation.

Assignment Due Next Class: Read Chapter 7. Rework Homework 5b so that it implements and uses the Plist class defined in ~vickery/CS-200/Homework_6/plist.h. Be sure your application program links with ~vickery/CS-200/Homework_6/plist.o and runs correctly before implementing your own plist.o. Note: You are free to edit the private part of the Plist class definition in plist.h for this exercise, but no other public part.

Week 11 (11/19; 11/15)

When constructors and destructors are called. Static data members and static member functions. Declaring const objects and member functions that may be used with const objects. Initializing const data members. Compound classes and initializing subobjects.

Note: There will be an exam during the last 45 minutes of the first class after Thanksgiving recess.

Assignment Due Next Class: Read Chapter 8. Use gdb to step through Exercise 7.9 from the textbook. There is a web page on gdb at: http://babbage.cs.qc.edu/courses/cs701/Handouts/using_gdb.html.

Week 12 (11/26; 11/22)

Review of four uses of static in C++ and what they mean (static local variables, static global variables, static data members, static member functions). Operator overloading examples.

Assignment Due Next Class: (Homework #7) Add the commands clone and showclone to the driver program for your Plist class exercise. Your main() function should declare two objects of class Plist. In class we called them theList and cloneList. When the user enters the clone command, the main program does an assignment of theList to cloneList, and when the user enters the showclone command the program displays the current state of the cloneList Plist. Sample code:

      int main() {
      
      Plist       theList, cloneList;
      
      ...
      
          case DO_CLONE:
            cloneList = theList;
            break;
          case DO_SHOW_CLONE:
            cloneList.showList();
            break;
      ...
Submit two versions of plist.cc. One version, to be named plist_s.cc is to implement operator=() to do a shallow copy of the list, and the other version, to be named plist_d.cc is to implement operator=() to do a deep copy of the list. Be sure to test both versions of the program to make sure they behave as expected.

The following items are not required, but would be good practice for you:

If you do implement either of these, leave a README file in your project directory so I will know about it.

There will be an exam during the last 45 minutes of the next class. It will cover material from chapters 6-8 plus concepts covered in class that may not come directly from the book, such as the relationships between memory segments and the various elements of a C++ program. Doing Homework #7 will help prepare you for the exam. Students who received 90 or above on the previous exam do not have to take this one; if they do take it but score less than 90, it will not count against them.

Week 13 (12/3; 12/6)

Operator overloading. Unary and binary operators; how the compiler recognizes overloaded operators. The need for friend functions for operator<<() and operator>>().

Exam Number 3.

Week 14 (12/10; 12/13)

More operator overloading examples. Inheritance. "Is a" vs "has a" relationships (inheritance vs composition). Base classes and derived classes. Base/derived class pointer assignments.

Extra Credit Assignment. This assignment may be used to make up the equivalent of one "small" homework this term. (All homeworks were small except Homework 5b.) It must be submitted by midnight of December 23 to be elegible for credit. The assignment is to implement a new class derived from Plist that has the additional property of being sorted in either ascending or decending order. The constructor for this new class is to take an argument "up" or "down" that tells which way the list is to be sorted. Modify your main program so that there is one "up" list, one "down" list, and one "clone" list that might be a copy of either the up list or a down list. (The clone list should be of class Plist.) The user commands "up" and "down" tell the program which list new elements are to be added to.

Where to go from here. The following books are recommended for continuing your study of C++:

Reference Manual
There are two books on C++ written by Bjarne Stroustrup, the author of the C++ language. They give all the details of the the language, and explain the reasons the language has the features that it does. One is The C++ Programming Language, Second Edition, and the other is The Annotated C++ Reference Manual by Margaret A. Ellis and Stroustrup. Both are published by Addison-Wesley, and are available from local bookstores.
The Standard Template Library
The Standard Template Library (STL) provides generic implementations of data structures and associated functions that can be used with objects of any type or class. Once you understand the language itself, using the library is the best way to implement real programs for the best portability, generality, and efficiency. The library is available for most C++ compilers, including the GNU compiler we used in this course. A good book on the STL is STL Tutorial and Reference Guide by David R. Musser and Atul Saini. Addison-Wesley, 1996.
Design Patterns
If you are interested in what is emerging as a key feature of object-oriented software engineering, you need to know about design patterns. The book that introduced the concept is Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Addison-Wesley, 1995. As the authors acknowledge, you won't "get it" the first time you read this book, but when you re-read it and continue to work in the field, you will get more and more out of it.

Final Exam (December 19)

The final exam for both my sections of CS-200 will be held on Thursday December 19 from 1:45 to 3:45 in SB C-201 (one of the lecture halls in the middle of the Science Building).

Exam questions may be drawn from the entire course, but the main emphasis will be on the material in Chapters 6-9 of the textbook.



Dr. Christopher Vickery
Computer Science Department
Queens College of CUNY
Home Page