Programming 2 (Mathematics) and Advanced Programming for Mathematicians (Data Science)
Undergraduate course, University of Novi Sad, 2024
This course introduces the students to object-oriented programming in C++. Since it is given to master students of mathematics—for many of whom it is the only computer science course that they are taking in the entire bachelor and master curriculum, apart from an introduction to programming in Python—I also used the opportunity to introduce various other topics which could help them become truly good programmers and which should, in my opinion, be part of general culture of any person taking a course in computer science. To further reduce the artificial gap between mathematics and computer science, I tried to use examples that are actually relevant to mathematicians, as well as to refer to historical contributions of various mathematicians to the establishment of computer science as a scientific discipline. Finally, I made an attempt to really explain why certain things have been designed a certain way, by exposing the students to some extent to what the hardware and the compiler are doing underneath, as well as to what is the fundamental purpose of some language constructs. My hope was that this would make everything much clearer and reduce the need to learn anything by heart.
Below you can find all of the slides as they appeared in 2024 (again in Serbian), apart from the ones from the last three lectures (covering templates, STL, and profiling Python code and rewriting the critical functions in C++), which were given in an interactive manner by writing code directly in the class, without any slides.
Slides
- Introduction
- Basic Principles of Computer Operation
- Types, Operators, and Expressions
- Control Flow
- Arrays and Pointers
- Functions
- Complex Data Types and Introduction to OOP
- More on OOP
- Templates and STL
- Templates and STL (continued)
- Some Additional Topics
Book used in the course
To anyone teaching programming to mathematicians, I highly recommend C++ for Mathematicians: An Introduction for Students and Professionals by Edward Scheinerman. Unlike most other books on programming that I have encountered, instead of relying on artificial examples and problems, it actually motivates the introduction of different language constructs by trying to solve progressively more and more complex mathematical problems of actual relevance. The mathematics involved is thoroughly explained and simple enough that even I could understand it (and I must admit, unfortunately, that my math is a bit rusty at this point), so any student that has recently taken a course in mathematics should have absolutely no problems grasping the content. At the same time, the book is rather comprehensive even from the standpoint of an introduction to programming and it introduces a lot of good engineering practices along the way, all wrapped in a coherent and simply beautiful story about using computers to help one conduct research in mathematics.