ICS 45C Fall 2021
Schedule


In lieu of a course textbook, assigned readings are the Notes and Examples from lecture. It is a good idea to skim the assigned reading before the lecture for the main ideas, attend lecture, and then to go through the assigned reading again to fill in the details that you missed, both in your initial skim of the reading and in the lecture.

Date Lecture Topics Readings Assigned Work
Week 0
Lectures
  • Course introduction and goals
  • How the course is organized remotely
  • The challenge of learning a second programming language
  • The challenge of learning C++ as a second programming language
  • Historical perspective and philosophical backdrop
  • Why C++ is the way it is: design goals
  • Virtualization: Running more than one operating system simultaneously
  • Quick overview of the ICS 45C VM development environment
  • Compilation and linking of a C++ program (briefly)
Week 1
Lectures
  • The main() function
  • Types and static type checking
  • Basic built-in data types
  • Console output using std::cout (briefly)
  • Expressions and statements
  • The if statement
  • while and for loops
  • The distinction between lvalues and rvalues
  • Declaration vs. definition
  • Calling and declaring functions
  • Parameters and arguments
  • The std::string type
  • A brief overview of standard input using std::cin
M 9/27
  • Begin working through Project #0
  • Aim to have the ICS 45C VM set up and ready to run today
Week 2
Lectures
  • Separate compilation and linking
  • Source and header files
  • The #include directive
  • Deciding on the boundaries between source files
  • Guarding against multiple inclusion of the same header file
  • Behind the scenes of a C++ program
  • The Von Neumann architecture (briefly)
  • Registers, instruction pointers, stack pointers, and frame pointers
  • Calling conventions
M 10/4 Project #0 due 11:59pm
F 10/8 Exercise Set 1 due 11:59pm
Week 3
Lectures
  • References
  • Pass-by-value vs. pass-by-reference parameters
  • Type conversions between basic built-in types
  • Function overloading
  • Default arguments
  • The heap (also known as the free store)
  • Heap-based memory allocation
  • The importance of cleaning up heap-allocated memory
  • Pointers
  • new and delete
  • The nullptr constant
W 10/13 Project #1 due 11:59pm
F 10/15 Exercise Set 2 due 11:59pm
Week 4
Lectures
  • Single-dimension arrays
  • Statically- and dynamically-allocated arrays
  • How arrays and pointers are related
  • Passing arrays as parameters to functions
  • The delete[] operator
  • C-style strings (and why we mostly avoid them)
  • Constants and the const qualifier
  • How const affects references and pointers
  • On the need for creating new types
  • Structures
  • Members in a structure
  • Statically- and dynamically-allocated structures
  • The . and -> operators
  • Uniform initialization and structures
  • Illuminating the dark corners
  • Undefined behavior in C++
  • Misuing memory
  • Memory leaks and dangling pointers
  • Valgrind and Memcheck (briefly)
  • The LLDB debugger (briefly)
F 10/22 Exercise Set 3 due 11:59pm
Week 5
Lectures
  • The (lack of a) distinction between built-in types and user-defined types
  • What is object-oriented programming?
  • Classes
  • Declaring classes
  • Access control (public and private)
  • Constructors
  • Member variables and member functions in a class
  • Statically- and dynamically-allocated objects of a class
  • Separating interface from implementation
  • Properly implementing constructors (e.g., using initializers)
  • The this pointer
  • Making a class const-aware
  • Function objects, std::function, and lambda expressions
  • Implementing linked data structures
  • Unit testing
  • Writing unit tests using Google Test
W 10/27 Project #2 due 11:59pm
F 10/29 Exercise Set 4 due 11:59pm
Week 6
Lectures
  • "Well-behaved" classes
  • Managing object lifetime
  • Managing other objects allocated by an object
  • Destructors
  • Building a "well-behaved" ArrayList class
  • Copy constructors
  • Overloading the assignment operator
  • Guarding against self-assignment
F 11/5 Exercise Set 5 due 11:59pm
Week 7
Lectures
  • More details about Project #3
  • std: The C++ Standard Library
  • Standard collections: std::vector and std::list
  • Iterators
  • auto and type inference
  • Generic algorithms
  • Inheritance
  • Constructors and derived classes
  • Order of construction and destruction of member variables
  • Layout of objects of derived classes
  • Virtual functions and polymorphism
  • Why destructors sometimes need to be virtual, but constructors don't
Th 11/11 University Holiday: Veterans Day — NO Q&A OR LABS TODAY
F 11/12 Project #3 due 11:59pm
Week 8
Lectures
  • Pure virtual functions
  • Abstract base classes
  • Why a class with nothing but pure virtual functions is still useful
  • Implicit type conversions (briefly)
  • Explicit constructors (briefly)
  • Static members of a class
  • Designing classes more carefully
  • Contracts
  • Preconditions and postconditions
  • Class invariants
  • Exceptions
  • Throwing and catching exceptions
  • Exception safety
M 11/15 Exercise Set 6 due 11:59pm
Week 9
Lectures
  • Why exceptions have a profound impact on design in C++
  • The "resource acquisition is initialization" (RAII) technique
  • Depending on destructors to automate release of memory and other resources
  • The "Rule of Zero"
  • Implementing a simple smart pointer
  • Why we need templates
  • Function templates
  • Class templates
M 11/22 Exercise Set 7 due 11:59pm
Th 11/25 University Holiday: Thanksgiving — NO Q&A OR LABS TODAY
F 11/26 University Holiday: Thanksgiving — NO LABS TODAY
Week 10
Lectures
  • NO NEW LECTURE MATERIAL THIS WEEK
  • NO Q&A THIS WEEK
M 11/29 Project #4 due 11:59pm
Tu 11/30 Exercise Set 8 due 11:59pm
Finals Week
Tu 12/7 Final Project due 11:59pm