This is a draft for weekly, detailed outcomes for CSC 2210. It is based on
the notes used by Dr. Hasker in Spring, 2024. Some material may be off by a
week either direction, and there may be mistakes. See the course notes for
additional detail.
Week 1: Procedural C++
- Day 1: Syllabus, note 1 - some spillover expected
- Limitations of Java and Python, especially for time-critical software, and
the need to learn new languages
- Day 2: C++ 101 (note 2; this material is reflected in Chapters 1 & 2)
- Creating a hello-world program in CLion, extending it to a simple program
to read and compare numbers.
- Writing an end-of-file controlled program to compute the average of a
list of numbers read from input.
- Similarities, differences from Java in simple programs.
- The basic steps in running a C++ program: compilation and linking.
- Core C++ types and their operations including initialization and constant
declarations.
- An introduction to scope and lifetime in C++.
- Using
const
and constexpr
to create named constants.
- Writing code to read data into an array.
- Using a five-step plan for writing loops: identify termination, using
De Morgan’s law to invert the condition to create loop header, write
the loop body with minimal progress, add setup and cleanup.
- Initializing arrays using
{
and }
, including the case where there are
fewer elements than required.
- Writing C++ functions including function overloading, optional arguments,
and simple cases of operator overloading.
- Illustrating that regular parameters are passed by value but arrays are
passed by reference.
- Day 3: Exercises 1 and 2 on installing CLion and using ESubmit; SPA 1 assigned
- NOTE: cut back on material in reading 2:
reading 2 on loops: dramatically cut down; the for loops are tedious
because there are too many of them, and I don't think that
first section is necessary at all; SAME with 6.1 on functions
Week 2
- Day 1, 2, 3: finish note 2, start note 3
- Day 3: publish SPA 2
- Day 4: Quiz, work day finishing spa 1 (due the next day), start spa 2
- General syntax and semantics of C++ functions
- By end of week: finish readings, spa 1, get started spa 2
- Reading to prep for week 3: computers and memory
Week 3
- Day 1, 2: note 3 on basic architecture, binary representation
- The major components of a computer, including the bus, RAM, and CPU
- The impact of the speed of light on computations, especially the need for
registers
- Binary to decimal conversion and vice versa
- Twos-complement representation of binary values
- Hexadecimal representation of binary data
- Day 3: Exercise 3: binary/decimal exercise (Canvas quiz)
- Day 4: Note 4 on assembly programming
- A brief history of the Intel x86 architecture and word/register sizes
- Core 64-bit instructions and registers:
mov
, xor
, ret
, and
, or
,
not
, imul
, add
, push
, pop
, %rax
, %rbx
, %rcx
, %rdx
immediate values
- Segment markers:
.data
, .text
, .global
- Week 3 reading:
Week 4
- Day 1, 2: continue note 4
- Day 3, 4: Note 5 on labels
- The structure of simple assembly programs, including comments to document
steps
- Using labels in assembly to implement loops
- Comparison instructions and SF, ZF, PF, CF flags
- Using
nop
and the concept of pseudo-instructions
- Implementing if statements in assembly
- [there’s a portion that needs additional work in note 5]
- Day 4: Discuss
fact.c
, fact.s
, have students do exercise 4
- Day 4: Make exercise 5 available for students working ahead
- Week 4 reading:
Week 5
- Day 1: stack frames/memory layout (note 5)
- Day 2: arrays in assembly, review
- Day 3: Exam 1
- Day 4: note 6, “Introduction to Classes”
- the todo example is really a review of arrays with minimal content
regarding classes
- Using methods with std::string
- Writing a simple class capturing a todo list of items where each item is
a string, including arrays, and
constexpr
with operations for size,
add, nth, remove by position and text, public
and private
.
- The difference between simple Java classes and simple C++ classes.
- Week 5 reading:
Week 6
- Day 1, 2: note 6, declarations vs. definitions; got through ave.cpp example
- Declaration vs. declaration for variables, functions, and classes
- Separating declarations of methods from definitions
- Separate compilation with
#include
, header files (using .h
), and
linking object files.
- The C Pre-Processor (CPP) and
#include
.
- Using
#ifndef
/#define
to ensure classes are defined only once.
- Day 3, 4: note 7 on pointers
- The distinction between addresses and values.
- Pointers to arrays
- Week 6 reading:
Week 7
- Day 1: note 7 on pointers: concrete types
- Concrete types (such as complex numbers) with classes; classes allow
creating new types that look and feel like built-in types
- Const methods that access information but do not change it.
- Day 2: start SPA 3
- Day 3, 4 Completing note 7
- Using pointers to implement a class that contains a growable array.
- Drawing memory maps of data.
- Common problems with arrays and pointers.
- How arrays and pointers appear in assembly code.
- Week 7 reading:
Week 8
- Day 1–3: note 8: representing floats
- Why we need a new type to represent floats; why integers will not work
- IEEE Std 754 Floating Point representation for 16-bit and 32-bit
architectures
- Converting a binary float value to decimal
- Converting a decimal float to binary
- The complexities of floating-point addition, multiplication
- Single vs. double precision floats
- Three ways to view types, as illustrated by floating-point values
- Day 4: Exercise processing floating-point values
- Week 8 reading:
Week 9
- Day 1–4: Note 9 on inheritance
- Abstract data types and the importance of inheritance to ADTs
- Virtual methods and override
- Using inheritance to add information to a type, not remove it
: public
as the standard way for inheritance; avoid : private
or :protected
- The order constructors are executed when for inheritance
- Mixing pointers with classes and inheritance
- Using
delete
to free space
- Abstract classes: pure virtual methods
- Implementing efficient inheritance with virtual function tables
- Week 9 reading:
Week 10
- Day 1, 2: Start SPA 4 on hunt the wumpus (working in teams of 2 to 3)
- Day 3, 4: Pointers, classes, and abstract classes
- Introducing abstract classes so can program to interfaces, not
implementations
- Abstract classes working with pointers and references, but not value
parameters
- Const arguments and const methods with classes as reference parameters
- Week 10 reading:
Week 11
- Day 1: note 9, Using Abstract Classes
- Review pass-by-value vs. pass-by-reference and the implication of
pass-by-reference disallowing
nullptr
parameters
- The
delete
and new
operators; having a delete
for every new
- Virtual destructors
- Container classes and reference values
- Resource acquisition is initialization (RAII): no naked
new
operations
- Using abstract classes in code
- Using namespaces to group names
- Robust use of header files.
- The dangers of “bad” inheritance - using inheritance to attempt to
remove operators, a violation of the Liskov Substitution Principle (LSP)
- Virtual function tables (vtables), and how this reflects the LSP
rule against “throwing away” data.
- Day 2–4: Templates
- Writing stand-alone template functions with parameterized types
- Writing a simple template class to generalize from a simple data type to
containers of arbitrary elements
- All elements in a template container have the same type; this is different
from Java which allows any
Object
to be placed in a container.
- Templates allow parameterizing on constants as well as types.
- The Standard Template Library (STL); in particular,
std::vector
(with
no index check by operator[]
), std::list
, std::map
.
- Iterating over collections.
- The
<algorithm>
library with examples of common operations like sort
,
fill
, reverse
, etc., and their applicability to simple arrays.
- Duck-typing with template classes such as
std::list
.
- Day 4: review for exam 2
Week 12
- Day 1: work day for exercise 8 on using the STL, especially iterators
- Day 2: work day on SPA 4b
- Day 3: exam 2
- Day 4: inline declaration, optimization; start discussion of C (rpn.c)
inline
declarations for regular functions and virtual methods.
- Minimal overhead related to STL: nearly all operations are inline, so
most of the code “compiles away”.
Week 13
- Day 1–3: Note 11 on C
- C as C++ without classes: functions, data types,
printf
, scanf
- Using Makefiles to compile code, especially the target, dependency list,
and command with tabs before each command.
- C-style (null-terminated) strings and
strlen
, strcpy
, strcmp
, and
strcat
- Safe C-style string operations:
strncpy
, strncmp
, strncat
.
- Structures in C and their relationship to classes.
- Structures as parameters.
- Using
malloc
for new
UPDATE NOTE PAGE TO INCLUDE
- Mixing nested structures and arrays.
#define
to substitute strings during compilation
- The dangers of writing macros using
#define
- Using
#define
, #ifnef
, #endif
for conditional compilation.
- Union types in C (and C++)
- Type equivalence rules in C and C++.
- Day 4: start SPA on structs
Week 14
- Day 1–2: note 12 on the Big 5, note 13 on Streams
- The hazards of copying structures without overloading operators.
- Writing a copy constructors, destructors, and assignment operators.
- The need for move operators and move constructors and how to write each.
- The rule of five.
- How
std::string::c_str
works and the dangers of returning a pointer.
- Using
getline
to read text files into std::string
objects.
- The
goodbit
, eofbit
, failbit
status variables, understanding why
.good()
is the preferred check for valid data.
- Defining read, write operations for new classes.
- Using
ifstream
, ofstream
, and sstream
to read and write data.
- Day 3: note 14 on casts and containers
- ADD? discussion on lvalue, rvalue
- The application of const_cast, dynamic_cast, static_cast and how they
replace the old-fashioned casting operator ().
- ADD: discussion of iterators and containers and invalidation
rules
- Day 4: assignment on STL with copy constructors
- TODO: add assignment on writing constructors in inherited classes
- Order constructors and destructors called with inheritance.
Week 15
- Day 1: Complete discussion of note 14; do evaluations
- Day 2: Note 15 - **UPDATE THIS SLIDE DECK - drop calloc/malloc **
- Memory layout
- Call by value parameters, call by reference
- Day 3: Note 16 on Types
- Learning types as a key to learning new programming languages
- Three definitions (views) of a type
- Type holes in C because of default types
- High level view of casting in C++, how that impacts maintainability
- Friend declarations in C++: another type loophole
- Comparisons to type systems for Ada, Java
- The dangers of describing a type system as “weak”
- Typed function pointers, and using them to implement objects in C
- A hierarchy of computing abstractions, especially high level, low level,
assembly, microcode, and gate logic
- The application of this layered view to everyday programming
- Day 4: Review for final exam