ICS 45C Fall 2019

In lieu of a course textbook, assigned readings are the Notes and Examples from lecture, which I'll try to keep posted ahead of where we are in lecture at any given time. 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 Project Work
Week 0
Th 9/26
  • Course introduction and goals
  • 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
  • The main() function
  • Types and static type checking
  • Basic built-in data types
  • Console output using std::cout (briefly)
Week 1
Tu 10/1
  • 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
  • Begin working through Project #0
  • Aim to have the ICS 45C VM set up and ready to run today
Th 10/3
  • The std::string type
  • A brief overview of standard input using std::cin
  • Separate compilation and linking
  • Source and header files
  • The #include directive
Week 2
Tu 10/8
  • 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
Th 10/10
  • References
  • Pass-by-value vs. pass-by-reference parameters
  • Type conversions between basic built-in types
  • Function overloading
  • Default arguments
F 10/11 Project #0 due 11:59pm
Week 3
Tu 10/15
  • 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
Th 10/17
  • 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)
Week 4
M 10/21 Project #1 due 11:59pm
Tu 10/22
  • 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
Th 10/24
  • Illuminating the dark corners
  • Undefined behavior in C++
  • Misuing memory
  • Memory leaks and dangling pointers
  • Valgrind and Memcheck (briefly)
  • The LLDB debugger (briefly)
Week 5
Tu 10/29
  • 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
Th 10/31
  • Function objects, std::function, and lambda expressions
  • Implementing linked data structures
  • Unit testing
  • Writing unit tests using Google Test
F 11/1 Project #2 due 11:59pm
Week 6
Tu 11/5
  • "Well-behaved" classes
  • Managing object lifetime
  • Managing other objects allocated by an object
  • Destructors
  • Building a "well-behaved" ArrayList class
Th 11/7
  • MIDTERM — regular lecture time and location
Week 7
M 11/11
  • University Holiday: Veterans Day — NO LABS TODAY
Tu 11/12
  • Building a "well-behaved" ArrayList class (continued)
  • Copy constructors
  • Overloading the assignment operator
  • Guarding against self-assignment
Th 11/14
  • More details about Project #3
  • std: The C++ Standard Library
  • Standard collections: std::vector and std::list
  • Iterators
Week 8
Tu 11/19
  • auto and type inference
  • Generic algorithms
  • Inheritance
  • Constructors and derived classes
  • Order of construction and destruction of member variables
Th 11/21
  • Layout of objects of derived classes
  • Virtual functions and polymorphism
  • Why destructors sometimes need to be virtual, but constructors don't
  • Pure virtual functions
  • Abstract base classes
  • Why a class with nothing but pure virtual functions is still useful
Week 9
M 11/25 Project #3 due 11:59pm
Tu 11/26
  • 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
Th 11/28
  • University Holiday: Thanksgiving — NO LECTURE OR LABS TODAY
F 11/29
  • University Holiday: Thanksgiving — NO LABS TODAY
Week 10
Tu 12/3
  • 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
Th 12/5
  • Why we need templates
  • Function templates
  • Class templates
  • Course conclusion
F 12/6 Project #4 due 11:59pm
Finals Week
Tu 12/10
  • FINAL EXAM: 7:00pm-9:00pm, HSLH 100A