ICS 45C Spring 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 1
Tu 4/2
  • 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)
Th 4/4
  • 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
Week 2
Tu 4/9
  • The std::string type
  • A brief overview of standard input using std::cin
  • Separate compilation and linking
  • Source and header files
  • The #include directive
Th 4/11
  • 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
F 4/12 Project #0 due 11:59pm
Week 3
Tu 4/16
  • References
  • Pass-by-value vs. pass-by-reference parameters
  • Type conversions between basic built-in types
  • Function overloading
  • Default arguments
Th 4/18
Week 4
M 4/22 Project #1 due 11:59pm
Tu 4/23
  • 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 4/25
  • 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 5
Tu 4/30
  • 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 5/2
  • Illuminating the dark corners
  • Undefined behavior in C++
  • Misuing memory
  • Memory leaks and dangling pointers
  • Valgrind and Memcheck (briefly)
  • The LLDB debugger (briefly)
Week 6
M 5/6 Project #2 due 11:59pm
Tu 5/7
  • 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 5/9
  • MIDTERM: regular lecture time and location
  • (You must attend the exam in the lecture in which you're enrolled)
Week 7
Tu 5/14
  • Function objects, std::function, and lambda expressions
  • Implementing linked data structures
  • Unit testing
  • Writing unit tests using Google Test
Th 5/16
  • "Well-behaved" classes
  • Managing object lifetime
  • Managing other objects allocated by an object
  • Destructors
  • Building a "well-behaved" ArrayList class
Week 8
Tu 5/21
  • Building a "well-behaved" ArrayList class (continued)
  • Copy constructors
  • Overloading the assignment operator
  • Guarding against self-assignment
  • std: The C++ Standard Library
  • Standard collections: std::vector and std::list
  • Iterators
Th 5/23
  • auto and type inference
  • Generic algorithms
  • Inheritance
  • Constructors and derived classes
  • Order of construction and destruction of member variables
Week 9
M 5/27
Project #3 due 11:59pm
Tu 5/28
  • 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
Th 5/30
  • 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
Week 10
Tu 6/4
  • 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 6/6
  • Why we need templates
  • Function templates
  • Class templates
  • Course conclusion
F 6/7 Project #4 due 11:59pm
Finals Week
Tu 6/11
  • FINAL EXAM (Lecture B): 7:00pm-9:00pm, HSLH 100A
Th 6/13
  • FINAL EXAM (Lecture A): 4:00pm-6:00pm, HSLH 100A