-
Notifications
You must be signed in to change notification settings - Fork 0
Course contents (draft)
J-Donald Tournier edited this page Oct 24, 2024
·
13 revisions
- the command-line
- navigating the filesystem
- invoking the compiler
- using an editor: micro (or notepad++)
- writing our first
hello_world.cpp
- plain old data (POD) types:
bool
,int
,float
,double
- the
std::string
class - command-line arguments
- the
std::vector
class - range-based
for
loop - the
auto
keyword
- the
while
loop -
do
-while
loop -
switch
statement - jump statements:
break
andcontinue
- conditional (ternary) operator (
?:
) - using functions
- defining functions
- variable scope: global, block, function
- default arguments for functions
- function overloading
- returning values from functions
- references
-
const
for variables -
const
for pass-by-reference - references,
const
&auto
in range-basedfor
loops - pass by value vs. pass by reference
- the
inline
keyword - the function stack and recursion
- relationship to scope
- terminal I/O
- file input/output
- introduce concept of RAII?
- relate to scope
- handling file paths
- introducing first project: DNA shotgun sequencing (?)
- exercise: implement loading function for project
- separate code into header and cpp files
- how to compile and link at the command-line
- explain C preprocessor in more detail
- automated build systems
- Make, CMake, Ninja, ...
- introduce our custom
build
script
- explain namespaces (in particular
std
)- what they are, no need for students to know how to define their own
- grouping data using struct
- categoricals using
enum
- classes
- member functions: mutators, accessors, facilitators
- constructors
- member initialisation
- destructors
- member function overloading
- inheritance
- virtual functions
- difference between virtual and overloaded functions
- static / dynamic binding
- pure virtual functions
- abstract and concrete classes
- 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
- ...?
- 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
- how to teach design?
- how to assess design?
-
new
/delete
- memory leaks
- double free
- array
new[]
&delete[]
- using constructor / destructor / copy constructor / assignment operator to manage memory
- Why? See recommendations in this video:
- difference between compiled and interpreted languages
- the preprocessor and directives
- the
#include
statement - the compile & link process
- C vs. C++
- dynamic vs. static type checking
- namespaces - the
std::
namespace - namespaces - how to define & use your own
- single-line comments
- multi-line comments and why they're usually best avoided
- editing a file
- compiling a program
- using the command-line
- file path concepts (absolute, relative)
- shortcuts for special folders (
.
,..
,~
) - running a command - even when not in the PATH, or in the current folder
- debugging a program - using a debugger?
- anatomy of a command - arguments & options
- statements
- compound statements
std::vector
std::string
std::array
- difference between
std::vector::operator[]
andstd::vector::at()
in terms of bounds checking - checking for errors
- throwing exceptions
- handling exceptions
- standard arithmetic operators
- comparison operators
- logical operators
- operator precedence
- standard data types
- expressions with mixed types, implicit type casting, integer promotion, ...
-
const
for variables -
const
for pass-by-reference -
const
for member methods - the
<cmath>
header and associated functions - list initialisers
- control flow
-
if
statement - nested
if
statements - regular
for
loop - range-based
for
loop -
while
loop -
do
-while
loop -
switch
statement - jump statements:
break
andcontinue
- conditional (ternary) operator (
?:
) - references
- using functions
- defining functions
- pass by value vs. pass by reference
- returning values from functions
- default arguments for functions
- function overloading
- variable scope: global, block, function
- spreading projects over multiple files
- multiple files: implications for compiling & linking
- function recursion
- the program stack
- inline functions
- struct
- enum
- file I/O
- OOP principles: encapsulation, polymorphism, inheritance, abstraction
- classes
- member functions: mutators, accessors, facilitators
- constructors
- member initialisation
- 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
- overloading the stream insertion operator
- operator overloading: global or member?
-
this
pointer - overloading the assignment operator
- function templates
- class templates
- runtime vs. compile-time/static polymorphism
- RAII
- object lifetime & ownership
- relationship to composition & aggregation, etc.
- class vs. object vs. instance
-
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
-
blog abour OOP design process
- how to teach design?
- how to assess design?