ICS 45C Spring 2022
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 1
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)
  • 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
Th 3/31
  • Begin working through Project #0
  • Aim to have the ICS 45C set up and ready to run today
Week 2
Lectures
  • The std::string type
  • A brief overview of standard input using std::cin
  • 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
W 4/6
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 4/13
F 4/15
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
Videos
  • Illuminating the dark corners
  • Undefined behavior in C++
  • Misuing memory
  • Memory leaks and dangling pointers
  • Valgrind and Memcheck (briefly)
  • The LLDB debugger (briefly)
W 4/20
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
Videos
  • Implementing linked data structures
  • Unit testing
  • Writing unit tests using Google Test
W 4/27
F 4/29
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
W 5/4
Week 7
Lectures
  • 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
W 5/11
F 5/13
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
W 5/18
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
W 5/25
Week 10
Lectures
  • Something fun to be announced later (time permitting)
M 5/30
    University Holiday: Memorial Day — NO LABS TODAY
Tu 5/31
W 6/1
Finals Week
Th 6/9
  • FINAL EXAM: 4:00pm-6:00pm, EH 1200