UP ONE LEVEL: ENGG 335 Home Page

ENGG 335 Fall 1997
Summaries of L02 Lecture Topics

This page is maintained by Steve Norman
Last modified: Sat Dec 6 18:11:24 MST 1997

Note carefully! I will not be putting my lecture notes on line. I expect students to attend lectures. If you miss a lecture, the best way to get the lecture notes is to borrow them from a fellow student.

Lecture content in Section L01 (Dr. Turner's section) will be very similar to that of L02.

Numbers listed after ``related reading'' are section numbers from the course text. The organization of material in lectures does not exactly match the organization of material in the textbook, so when I list ``related reading'', I can't be completely precise. In some cases using the index or table of contents will help you find additional information.

Here is a link to the current week's lectures.


Week 1

Lecture #1 (Mon., Sept. 8)
Welcome to ENGG 335. Explanation of policies on the course outline.
Related reading: none.
Lecture #2 (Wed., Sept. 10)
C++ source file organization in ENGG 335. Concept of a module as a combination of interface and implementation.
Related reading: Savitch, 8.2.
Lecture #3 (Fri., Sept. 12)
Building an executable from source files: the different roles played by the preprocessor, the compiler, and the linker.
Related reading: Savitch, 8.2.

Week 2

Lecture #4 (Mon., Sept. 15)
How true and false are represented in C++. Review of use of sclArray types; examples of code using sclArray<int> type.
Related reading: Savitch, 7.1, 9.1-9.3; scl Introduction and Tutorial, Section 2.
Lecture #5 (Wed., Sept. 17)
Procedural abstraction. Function interface comments using REQUIRES and PROMISES. Use of assert.
Related reading: Savitch, 3.4, 4.3; Function Interface Comments handout.
Lecture #6 (Fri., Sept. 19)
A first step in visualizing memory use--diagrams of activation records and the stack. Graphical representations for call-by-value and call-by-reference.
Related reading: Activation Records and the Stack handout; Savitch, 4.2.

Week 3

Lecture #7 (Mon., Sept. 22)
A model of computer memory--a giant array of bytes. Addresses of bytes and addresses of variables. Introduction to pointer variables and the address-of operator.
Related reading: Savitch, 1.1, 11.1
Lecture #8 (Wed., Sept. 24)
A simple example demonstrating use of pointers. Another example showing how pointers can be used as function arguments.
Related reading: Savitch, 11.1, More about memory diagrams (handout).
Lecture #9 (Fri., Sept. 26)
Quick introductions to built-in arrays and character strings. The char type, character codes, and the ASCII character set.
Related reading: Savitch, 9.1, 10.1

Week 4

Lecture #10 (Mon., Sept. 29)
Examples of code using built-in strings. How to use the strcpy function; how the strcpy function works. How arrays and string constants are compatible with pointer types in function calls.
Related reading: Savitch, 10.1
Lecture #11 (Wed., Oct. 1)
Explanation of strcpy's return value. What const means with pointer and reference arguments. Function arguments declared to be arrays are really pointers; an example to demonstrate this point.
Related reading: Savitch, 9.1, 9.2
Lecture #12 (Fri., Oct. 3)
The difference between initialization and assignment. Rules for initialization of built-in arrays, rules for initialization of pointer variables.

Week 5

Lecture #13 (Mon., Oct. 6)
Brief review of struct types. Comparison of array and struct types. Introduction to class types with a simple example.
Related reading: Savitch, 6.1, 6.2
Lecture #14 (Wed., Oct. 8)
Terminology: class vs. object. The role of ctor (constructor) functions. The difference between const and non-const member functions.
Related reading: Savitch, 6.2
Lecture #15 (Fri., Oct. 10)
Access control: public members and private members. The ADT (abstract data type) concept; specification of a List ADT and remarks about how to implement the ADT in C++.
Related reading: Savitch, 6.2, 6.3; Lab 5 Exercise B instructions and code.

Week 6

Lecture #16 (Wed., Oct. 15)
Pointers to struct variables and objects. The -> (``arrow'') operator. The this pointer--a special pointer-to-object available in member function definitions.
Related reading: Pointers to Struct Variables and Objects (course handout); Savitch, Appendix 9.
Lecture #17 (Fri., Oct. 17)
Example program with pointerss and references to objects. Overview of different uses seen so far for pointers. Private member functions.

Week 7

Lecture #18 (Mon., Oct. 20)
Three regions of memory: stack, static storage, free store. General concept of dynamically allocated memory. Example uses of new to allocate arrays.
Related reading: Savitch, 11.1, 11.2
Lecture #19 (Wed., Oct. 22)
Use of delete to deallocate dynamic memory. How to reduce risk of fouling up with dynamic memory--use classes to manage dynamic memory, and make sure each class has a memory management strategy. Beginning of an example: the StringOne class.
Related reading: Savitch, 11.2, 11.3
Lecture #20 (Fri., Oct. 24)
Examination of StringOne member functions. What the destructor does. Problems that arise due to memberwise copying of StringOne objects.
Related reading: Savitch, 11.3

Week 8

Lecture #21 (Mon., Oct. 27)
The StringTwo class--same as StringOne, but with a copy constructor and an assignment operator. Definition of copy ctor. Different ways the copy ctor can be called. Issues that come up in writing an assignment operator: self-assignment and chaining.
Related reading: Savitch, 11.3
Lecture #22 (Wed., Oct. 29)
The law of the big 3 (dtor, copy ctor, assignment operator). How the assignment operator works for the StringTwo class.
Related reading: Assignment Operator Details (handout)
Lecture #23 (Fri., Oct. 31)
Different approaches to software design: procedual decomposition, object-based programming, object-oriented programming.
Related reading: none

Week 9

Lecture #24 (Mon., Nov. 3)
The null pointer. Introduction to linked lists.
Related reading: Savitch, 14.1
Lecture #25 (Wed., Nov. 5)
Short-circuit evaluation of expressions involving || and &&.
Careful study of OLList::insert.
Rules about delete and delete[]; what happens when you do a delete with a null pointer.
Related reading: Savitch, 14.1 and page 348; definition of OLList::insert (on handout, also in Lab 8 Ex A and B).
Lecture #26 (Fri., Nov. 7)
Quick study of OLList::remove. The copy ctor, assignment operator, and dtor for OLList. Brief general remarks about linked lists.
Related reading: Savitch, 14.1; definition of OLList::remove (on handout, also in Lab 8 Ex A and B).

Week 10

Lecture #27 (Wed., Nov. 12)
Brief review of implicit type conversion for built-in types. Use of one-argument constructors for conversion to class types. Creation of temporary variables so that there is something to attach reference argument to. Explicit type conversion--C++ function-call syntax, C-style cast syntax.
Related reading: Savitch, pages 148-152, 448-450; Lab 8 Exercise C.
Lecture #28 (Fri., Nov. 14)
Some kinds of class relationships: composition, type parametrization, inheritance. Inheritance as an IS-A relationship. Introduction to inheritance in C++.
Related reading: Lab 7 Exercise B (example of type parametrization).

Week 11

Lecture #29 (Mon., Nov. 17)
Inheritance and member functions. The BaseAList/AList/OAList example. The IS-A relationship: references/pointers to base types can refer/point to derived class objects.
Related reading: Example Three in Inheritance Examples handout; Savitch, 5.4.
Lecture #30 (Wed., Nov. 19)
Static binding and dynamic binding, and virtual functions. Pure virtual functions and abstract base classes. Explanation of the Animal/Cat/Dog examples.
Related reading: Examples One and Two in Inheritance Examples handout.
Lecture #31 (Fri., Nov. 21)
A bit more about virtual and pure virtual functions. Brief discussion of the tic-tac-toe game of Lab 9 Exercise D.
Introduction to pointer arithmetic.
Related reading: Lab 9 Exercise D instructions; Savitch, page 641--642.

Week 12

Lecture #32 (Mon., Nov. 24)
More about pointer arithmetic. A simple example: implementing strlen with pointer arithmetic. Introduction to pointers-to-pointers.
Related reading: `Read This First' sections in Lab 10 handout.
Lecture #33 (Wed., Nov. 26)
Arrays of pointers. Example: operations on an array of pointers to beginnings of strings.
Related reading: `Read This First' sections in Lab 10 handout.
Lecture #34 (Fri., Nov. 28)
Completion of example from Lecture #33.
Introduction to recursion. Simple example of recursion: computing 1+2+...+n.
Related reading: Savitch, 12.1, 12.2.

Week 13

Lecture #35 (Mon., Dec. 1)
Another very simple example of recursion: printing a string backwards. Introduction to divide-and-conquer strategies, with a simple example. Introduction to the quicksort algorithm.
Related reading: Savitch, 12.1, 12.2, 12.3.
Lecture #36 (Wed., Dec. 3)
C++ code for quicksort (omitting the partitioning code, which is the hard part of the job).
How to design a recursive function--very introductory remarks intended as hints for the Exercises on Recursion.
Related reading: Exercises on Recursion handout
Lecture #37 (Fri., Dec. 5)
Efficiency considerations for resizable array classes--why "always allocate a free store array of exactly the right size" may lead to very slow programs.
Remarks about Lab 7 Ex F (phone list program) and Lab 9 Ex D (tic-tac-toe program).
A (ridiculously brief and incomplete) summary of course content and goals.
Related reading: none

Jump to the top of this page.