Skip to content

Course contents (draft)

J-Donald Tournier edited this page Oct 24, 2024 · 13 revisions

Week 1

Session 1: Introduction to the command-line, first steps

  • 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

Exercises??

Session 2: formalise control flow, terminal IO & functions

  • the while loop
  • do-while loop
  • switch statement
  • jump statements: break and continue
  • 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-based for loops
  • pass by value vs. pass by reference
  • the inline keyword
  • the function stack and recursion
    • relationship to scope

Week 2

Session 1: file IO

  • 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

Session 2: split project files

  • 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

Week 3

Session 1: Organising data

  • grouping data using struct
  • categoricals using enum
  • classes
  • member functions: mutators, accessors, facilitators
  • constructors
  • member initialisation
  • destructors
  • member function overloading

Session 2:

  • inheritance
  • virtual functions
  • difference between virtual and overloaded functions
  • static / dynamic binding
  • pure virtual functions
  • abstract and concrete classes

Week 4

Session 1:

Session 2:


Week 5

Session 1:

Session 2:


Week 6

Session 1: Object-oriented design

  • 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

Session 2:

  • Peer marking
  • go through solution and marking scheme
  • ...?

Week 7

Session 1:

Session 2:


Week 8

Session 1:

Session 2:


Week 9

Session 1:

Session 2:


Week 10

Session 1:

Session 2:


Open questions:

  • how use inheritance in a meaningful way without pointers?
    • should be fine using references instead
  • how to demonstrate aggregation without pointers?
  • how to teach design?
  • how to assess design?

Not covered in course:


Unsorted topics to be (or not) covered:

  • 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[] and std::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 and continue
  • 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?