Introduction to Modern C++ (2016)

Université Paris I -- Panthéon-Sorbonne
Masters MAEF, QEM, MEEF

Lecturer: Rémi Géraud

Course description.

This is an introduction-level course to modern C++ programming.

C++ is a programming language developped in the late 1970's to provide higher-level constructs on top of the well-known C programming language. For a long time, this C legacy has crippled the use and adoption of newer features specific to C++. Fast-forward forty years, C++ is no longer the tool of choice when it comes to quick prototyping, and has proliferated into a tentacular language. Yet, C++ is still present in most software and remains one of the most popular programming languages.

Unlike more recent programming languages, C++ leaves almost every reponsibility in the programmers' hands: correctness, type safety (to some extent), security, resource management, concurrency, etc. The price, it is often believed, to be able to squeeze more performance from the computer.

In truth however, security and performance are absolutely compatible. In this course, students are taught how to implement efficient and high-quality programs, and they gain some theoretical insight about some of the quirks and gotchas of C++. They learn about the latest features of C++ (introducted in C++11, C++14 or C++17) and the logic underneath, trying to avoid legacy and unsafe C-style coding. Many connections are made with theoretical computer science and students' backgrounds and interests --- including simulation of financial assets, optimisation, numerical simulation and integration, and more.

The first part of the course will provide essential tools to start working autonomously and efficiently with C++. The second part will focus on advanced topics including graphics, multithreading, functional programming, template metaprogramming and others. The complete course totalises 42 hrs (lectures + labs).

Syllabus

  • Lecture 1 (28 Jan 2016):
    • Lecture: Prelude. History, Legacy and Dangers of C++. Setup and Tools. [pdf]
    • Lab 1: "Hello world". The compilation process. [pdf]
  • Lecture 2 (4 Feb 2016):
    • Lecture: Types. Statements. Arithmetic. [pdf]
    • Lab 2: Math, Arrays, Vectors, and the Quake III Arena trick. [pdf]
    • Homework 1: Black-Scholes European Call Option Pricing. [homework] [solution]
  • Lecture 3 (11 Feb 2016):
    • Lecture: Control flow. Algorithms. Turing's theorem. [pdf]
    • Erratum (p. 24): It is i instead of xi.
    • Erratum (p. 27): If the for loop for the factorial, it should be i <= n instead of i < n.
    • Lab 3: Sorting, Numerical integration, and Angry Birds. [pdf]
  • Lecture 4 (18 Feb 2016): 
    • Lecture: Pointers. References. Functions. [pdf]
    • Lab 4: Headers, Linked Lists, Recursion, and Dynamic programming. [pdf]
    • Homework 2: PRNGs, Monte-Carlo Integration, and Markov chains. Application to Portfolio evaluation and Credit rating migration. [homework] [solution]
  • Lecture 5 (25 Feb 2016):
    • Lecture: Structs/Classes: Members, Inheritance, and the Rule of 3/0/5. [pdf]
    • Lab 5: Const, Virtual, and Move Semantics. [pdf]
    • Erratum: If you have problems starting, avoid using a constructor in the Country class and remove parentheses in the definition of Germany.
  • Holiday break
  • Mid-term exam (10 Mar 2016) [pdf] [solution]
  • Lecture 6 (10 Mar 2016)
    • Lecture: A short review, the path onwards, and some machine learning [pdf]
    • Perceptron code [tar.gz]
    • Extra lab session (QEM/MMEF, 14 Mar 2016) : file streams and object-oriented reminder
  • Lecture 7 (17 Mar 2016 24 Mar 2016)
    • Lecture: Graphics with SDL, the Revenge of Angry Birds [pdf]
    • Starting package code [tar.gz]
  • Lecture 8 (24 Mar 2016 31 Mar 2016)
    • Lecture: Networking with cURL and libXML2 [pdf]
    • Starting package code [tar.gz]
  • Lecture 9 (7 Apr 2016)
    • Lecture: Managing large projects [pdf]
    • Starting package code [tar.gz]
  • Resit exam (27 Jun 2016) [pdf] [solution]

Textbook (optional)

Bjarne Stroustrup, Programming --- Principles and Practice Using C++ (2013)

Grading

Grading will be a weighted average of the following:

  • Presence at lectures and labs
  • Mid-term exam
  • Final project