-
Notifications
You must be signed in to change notification settings - Fork 0
Course contents (draft)
J-Donald Tournier edited this page Dec 9, 2024
·
20 revisions
- what is C++, relationship with C
- the command-line
- navigating the filesystem
- invoking the compiler
- using an editor: micro (or notepad++)
- writing our first
hello_world.cpp
- including standard headers
-
Basic data types:
bool
,int
,float
,double
- the
std::string
class - command-line arguments
- the
std::vector
class - range-based
for
loop - regular
for
loop -
type inference: the
auto
keyword - conditional execution: the
if
statement - statements and compound statements
- basic error handling
- Introduce DNA shotgun sequencing project
- std::cin, std::cout, std::cerr and their use
- reading data from file: std::iftream
- (const) references
- Using algorithms from the C++ Standard Template Library:
std::min()
,std::max()
- writing data to file: std::ofstream
- Using and defining functions
- returning values from functions
- type aliasing
- defining separate header and cpp files
- the role of the preprocessor
- automated build systems
- what they are and why we need one
- Make, CMake, Ninja, ...
- introduce our custom
oop_build
script
- Error handling using C++ exceptions
- More practice with functions and string handling
- More on using STL algorithms: iterators
- the
while
loop do
-while
loop
- adding debugging functionality to our project
- More command-line handling: options
- variable scope: global, block, function
- namespaces
-
the
inline
keyword and the One Definition Rule
- advanced string formatting using
std::format()
- grouping data into a
struct
- returning multiple values from functions using C++17 structured binding
- using
std::string_view
to avoid copies
- Introducing classes
- Default function arguments
- Constructor delegation (aka constructor chaining)
-
the
const
keyword: - for variables
- for function arguments
- for methods
- why pass by
const
reference - OOP features:
- more practice with:
- basic program structure and command-line argument handling
- file handling and loading data
- error handling and debugging
- creating a class
- handling multidimensional data arrays
- new concepts:
- more practice with:
- handling command-line arguments and options
- file handling
- writing functions
- using external libraries
- simple example of using an external header-only library: Donald's terminal_graphics project
- function overloading
- overloading the subscript or array indexing operator
- overloading the function call operator
- overloading the stream insertion operator
- class templates
-
the
<cmath>
header and associated functions
- lambda expressions
- use of lambda expressions with the C++ Standard Template Library (STL)
- the C++20
std::ranges
library - function templates
- finishing touches to fMRI project
- inheritance
- virtual functions
- difference between virtual and overloaded functions
- static / dynamic binding
- pure virtual functions
- abstract and concrete classes
- class vs. object vs. instance
- aggregation, composition, inheritance
- object lifetime & ownership
-
OOP design principles (SOLID):
- DRY (Don’t repeat yourself)
- Encapsulate What Changes
- Open Closed Design Principle
- Single Responsibility Principle
- Dependency Injection or Inversion principle
- Favor Composition over Inheritance
- Liskoff substitution principle
- Interface Segregation Principle
- Programming for Interface not implementation
- Delegation principles
- UML overview
- UML class diagrams
- typical workflow for the OOP design
- Peer marking
- go through solution and marking scheme
- ...?
- pointers
- C-style arrays
- C-style string handling
-
new
/delete
- memory leaks
- double free
- array
new[]
&delete[]
- using constructor / destructor / copy constructor / assignment operator to manage memory
switch
statement- jump statements:
break
andcontinue
- conditional (ternary) operator (
?:
) - Resource Acquisition Is Initialization (RAII)
- the function stack
- recursion
- categories using enumerated types (
enums
) - class destructor
- multi-line comments and why they're usually best avoided
- dynamic vs. static type checking
std::array
- difference between
std::vector::operator[]
andstd::vector::at()
in terms of bounds checking - expressions with mixed types, implicit type casting, integer promotion, ...
- destructors
- static data members
- copy constructor
- virtual functions
- pure virtual functions
- abstract and concrete classes
- inheritance vs. composition
- member function overloading
- difference between virtual and overloaded functions
- static / dynamic binding
- OOP design - REQUIRES A LOT OF THOUGHT!
- UML
- composition / aggregation / inheritance
- operator overloading
- friend functions
- operator overloading: global or member?
-
this
pointer - overloading the assignment operator
- runtime vs. compile-time/static polymorphism
- object lifetime & ownership
- relationship to composition & aggregation, etc.
- OOP principles: encapsulation, polymorphism, inheritance, abstraction
-
OOP design principles (SOLID):
- DRY (Don’t repeat yourself)
- Encapsulate What Changes
- Open Closed Design Principle
- Single Responsibility Principle
- Dependency Injection or Inversion principle
- Favor Composition over Inheritance
- Liskoff substitution principle
- Interface Segregation Principle
- Programming for Interface not implementation
- Delegation principles
- how use inheritance in a meaningful way without pointers?
- should be fine using references instead
- how to demonstrate aggregation without pointers?
- can demonstrate construction of member (const) reference
- note that non-const references are not recommended in the C++ Core Guidelines
- but only because this makes the class copy-constructable, but not copy-assignable
- if anything, highlights issues of ownership and lifetime, which are a serious problem with aggregation
-
blog abour OOP design process
- how to teach design?
- how to assess design?
- Why not use pointers and manual memory management? See recommendations in this video: